Date: Tue, 16 Oct 2001 12:18:58 -0600 From: Nate Williams <nate@yogotech.com> To: Dimitry Andric <dim@xs4all.nl> Cc: Nate Williams <nate@yogotech.com>, freebsd-stable@FreeBSD.ORG Subject: Re: Re[2]: setenv() cores with NULL value [was Re: Gdm proplem on 4.4] Message-ID: <15308.31250.176938.430969@nomad.yogotech.com> In-Reply-To: <441356059.20011016201751@xs4all.nl> 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> <441356059.20011016201751@xs4all.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
>
> NW> printf("%s", "");
> NW> printf("%s", NULL);
>
> NW> The first will work, the second will dump core.
>
> Nope, it will print the string "(null)", as you can see in
> /usr/src/lib/libc/stdio/vfprintf.c, around line 673:
>
> case 's':
> if ((cp = GETARG(char *)) == NULL)
> cp = "(null)";
>
> Almost any printf I've ever seen does the same.
Well, I'll be. :(
> NW> The second has never worked, and should never work.
>
> That's debatable. In the interest of consistency, it should surely
> coredump, but for the sake of compatibility, it shouldn't. You don't
> want to know how many times I see (null) strings in program messages,
> log files, etc. :)
Thanks for the clarification!
Nate
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?15308.31250.176938.430969>
