Date: Wed, 21 Aug 2002 22:52:25 -0400 From: Mike Barcroft <mike@FreeBSD.org> To: Garrett Wollman <wollman@lcs.mit.edu> Cc: archie@dellroad.org, arch@FreeBSD.org Subject: Re: NULL Message-ID: <20020821225225.B62302@espresso.q9media.com> In-Reply-To: <200208220245.g7M2jD8A004461@khavrinen.lcs.mit.edu>; from wollman@lcs.mit.edu on Wed, Aug 21, 2002 at 10:45:13PM -0400 References: <20020821.173653.57449387.imp@bsdimp.com> <200208212358.g7LNw8l08243@arch20m.dellroad.org> <200208220245.g7M2jD8A004461@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
Garrett Wollman <wollman@lcs.mit.edu> writes: > In article <200208212358.g7LNw8l08243@arch20m.dellroad.org> you write: > >Seems like the same is true of "0".. e.g., suppose that pointers > >are larger than integers, and you call a variadic function with > >"NULL" as one of the extra parameters: > > > > printf("foo=%p num=%d\n", NULL, 123); > > > >This would get screwed with NULL=0 but work right with NULL=(void *)0. > > That's a feature. (Unfortunately, this feature is not implemented on > ILP32 architectures. Is 0LL allowed as a null pointer constant? That > would break everyone equally in this case.) > > The ultimate answer is that both definitions are useful for finding > (or papering over) different bugs. An application could always cheat and define it's own version of NULL before including any headers. This would mainly be useful for finding bugs, but of course is completely unsupported and probably wouldn't work on other platforms unless they also conditionally define NULL. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020821225225.B62302>