Subject: Re: sys/null.h
To: Roland Illig <email@example.com>
From: Klaus Klein <firstname.lastname@example.org>
Date: 04/13/2005 19:14:55
On Wednesday, 13. April 2005 18:09, Roland Illig wrote:
> Hi all,
> To quote from the ISO C99 standard:
> The macros are
> which expands to an implementation-defined null pointer constant
> Currently, <sys/null.h> defines NULL to be 0.
There's nothing wrong per se with 0, if you have a look at section
188.8.131.52 #3 of that document.
However, we are not currently doing that:
date: 2003/10/21 03:27:32; author: fvdl; state: Exp; lines: +2 -6
Define NULL as (void *)0, unless C++ is being used.
> Now my questions are:
> * What happens on I32LP64 systems?
> fprintf(stderr, "%#p %#p\n", NULL, NULL, 1, 2, 3, 4);
> I would expect the answer to not be "0x0 0x0".
> * Why don't we always #define NULL ((void *) 0) ?
> (We don't have to be pre-ANSI compatible anyway.)