Subject: Re: sys/null.h
To: Roland Illig <roland.illig@gmx.de>
From: Klaus Klein <kleink@mibh.de>
List: tech-userlevel
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:
> 
> 7.17#3:
> The macros are
>           NULL
> 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
6.3.2.3 #3 of that document.

However, we are not currently doing that:

  revision 1.5
  date: 2003/10/21 03:27:32;  author: fvdl;  state: Exp;  lines: +2 -6
  Define NULL as (void *)0, unless C++ is being used.



- Klaus


> 
> 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.)
> 
> Roland
> 
>