Date: Mon, 21 Apr 2003 09:52:03 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: ertr1013@student.uu.se Cc: schweikh@freebsd.org Subject: Re: standards/50889: NULL defined as 0 instead of (void *)0 Message-ID: <20030421.095203.105584263.imp@bsdimp.com> In-Reply-To: <20030421104840.GA92922@falcon.midgard.homeip.net> References: <20030416172723.GA13575@falcon.midgard.homeip.net> <20030421.020106.41513803.imp@bsdimp.com> <20030421104840.GA92922@falcon.midgard.homeip.net>
index | next in thread | previous in thread | raw e-mail
In message: <20030421104840.GA92922@falcon.midgard.homeip.net>
Erik Trulsson <ertr1013@student.uu.se> writes:
: On Mon, Apr 21, 2003 at 02:01:06AM -0600, M. Warner Losh wrote:
: > I have a #define in my tree that I switch back and forth from time to
: > time:
: >
: > #if defined(_cplusplus) || !defined(_NULL_VOID)
: > #define NULL 0L
:
: Why not just plain 0?
: I think either will work fine so it doesn't matter really matter much
: but I am a bit curious.
Strange, but legal, to catch more issues.
: > #else
: > #define NULL (void *) 0
:
: Won't work correctly. You need to use ((void*)0) instead with the
: extra parenthesis. Otherwise expressions like 'sizeof NULL' will fail
: to compile.
Yes, I didn't cut and paste, but rather typed from memory.
Warner
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030421.095203.105584263.imp>
