Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Oct 2001 08:08:22 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: setenv() cores with NULL value [was Re: Gdm proplem on 4.4]
Message-ID:  <20011017080821.A71883@student.uu.se>
In-Reply-To: <nospam-1003290013.25209@mx1.gbch.net>
References:  <200110160353.f9G3rO728525@harmony.village.org> <Pine.LNX.4.33.0110152249220.8479-100000@organ.cs.byu.edu> <20011016013834.E293@blossom.cjclark.org> <200110161002.f9GA2CA08544@shalimar.net.au> <15308.25432.608079.646993@nomad.yogotech.com> <nospam-1003290013.25209@mx1.gbch.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 17, 2001 at 01:40:13PM +1000, Greg Black wrote:
> 
> And I think that all those printf() library functions that print
> "(null)" instead of allowing a core dump are doing the wrong
> thing too.  It's wrong, so don't do it.


According to the C standard printing "(null)" isn't *wrong* in this
situation.
Dereferencing a null pointer invokes undefined behaviour which means
that as far as the standard is concerned the compiler/library may do
whatever it wants. This includes but is not limited to:
1) Core dumping.
2) Printing "(null)".
3) Reformatting your hard drive.
4) Sending embarrasing love letters by email to your boss.
5) Making demons fly out of your nose.
6) All of the above at the same time.

Of these 1) and 2) are by far the most common responses but all the
others are (implicitly) allowed by the C standard.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011017080821.A71883>