Date: Tue, 16 Oct 2001 14:22:27 -0700 From: "Chad R. Larson" <chad@DCFinc.com> To: Nate Williams <nate@yogotech.com> Cc: Zero Sum <count@shalimar.net.au>, cjclark@alum.mit.edu, "Crist J. Clark" <cristjc@earthlink.net>, Heath Nielson <heath@cs.byu.edu>, Warner Losh <imp@harmony.village.org>, David Marker <marker_d@yahoo.com>, freebsd-stable@FreeBSD.ORG Subject: Re: setenv() cores with NULL value [was Re: Gdm proplem on 4.4] Message-ID: <20011016142227.A23454@freeway.dcfinc.com> In-Reply-To: <15308.25432.608079.646993@nomad.yogotech.com>; from nate@yogotech.com on Tue, Oct 16, 2001 at 10:42:00AM -0600 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>
next in thread | previous in thread | raw e-mail | index | archive | help
> Here's a great example of why they aren't the same thing. > > printf("%s", ""); > printf("%s", NULL); > > The first will work, the second will dump core. The second has never > worked, and should never work. As some people have pointed out, much early C code was written on DEC Vaxen, which returned zeros if you dereferenced a NULL pointer. So the second one would have worked. So, the code was wrong, but it did what the folks who wrote it thought it should do. -crl -- Chad R. Larson (CRL15) 602-953-1392 Brother, can you paradigm? chad@dcfinc.com chad@larsons.org larson1@home.com DCF, Inc. - 14623 North 49th Place, Scottsdale, Arizona 85254-2207 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?20011016142227.A23454>