Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Oct 2001 21:48:14 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Nate Williams <nate@yogotech.com>
Cc:        Dimitry Andric <dim@xs4all.nl>, 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:  <200110170448.f9H4mEW94727@apollo.backplane.com>
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> <15308.31250.176938.430969@nomad.yogotech.com>

next in thread | previous in thread | raw e-mail | index | archive | help

:>         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

    It depends how portable you want to be.  When I wrote Diablo I had
    bunches of logging printf's that would pass NULL string pointers.  It
    worked fine on FreeBSD and a couple of other platforms, and not so fine
    on some (I forget which ones).  So for portability I had to adjust the
    code to ensure that a NULL pointer would never be passed as a string.

						-Matt


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?200110170448.f9H4mEW94727>