What C compilers have non-zero null pointers?
Peter da Silva
peter at ficc.ferranti.com
Wed Jul 18 00:35:10 AEST 1990
In article <9007161750.AA00664 at edison.CHO.GE.COM> rja <rja at edison.cho.ge.com> writes:
> I used to use a compiler for MSDOS and the 80x86 cpus
> whose NULL pointer was F000:0000 hex when examined via
> a debugger. It of course did compile fine as long as one
> used sense and compared pointers to NULL rather than
> a constant of zero...
If that was the case, the compiler was broken. A constant zero in a pointer
context is the definition of NULL. !pointer == 0! and !pointer == NULL! should
evaluate the same way (as if they generated the same code).
> Compilers where NULL isn't represented as all zero bits
> just aren't that uncommon.
Compilers where it's something you need to watch out for should be.
--
Peter da Silva. `-_-'
+1 713 274 5180.
<peter at ficc.ferranti.com>
More information about the Comp.lang.c
mailing list