Subject: Re: NULL return value checking
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.ORG>
From: tld <>
List: tech-kern
Date: 04/24/2002 10:20:58
Greg A. Woods wrote:
 >> Assuming it is zero is technically incorrect. It *could* be
 >> non-zero, in
 > I'm pretty sure that's not true.
I read somewhere, NULL can be != 0

 > An integer constant expression with the value 0, or such an
 > expression cast to type (void *), is called a "null pointer
 > constant."  If a null pointer constant is converted to a pointer
 > type, the resulting pointer, called a "null pointer," is guaranteed
 > to compare unequal to a pointer to any object or function.
 > I.e. no matter how it's defined, NULL == 0.
Oh, well, then gcc-i386 is not following the standards: 0x00000000
references a VERY VALID memory address (the vector table)
A more appropriate value would be 0xffffffff (unless someone has 4gb or 
a mmap, that is). IMHO assuming NULL == 0 is bad practice if portability 
is a target.