the nil pointer is not zero

Ran Atkinson rja7m at hopper.cs.Virginia.EDU
Thu Nov 15 06:20:54 AEST 1990


In article <27636 at mimsy.umd.edu> chris at mimsy.umd.edu (Chris Torek) writes:
> On computers on which address location zero has `interesting' contents ...

In article <14459 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
% One implementation possibility is to use the address of some reserved
% object in the run-time library for the null pointer.

Indeed, a compiler used on a former project had the NULL pointer address
be 0xf0000000 because that happened to point into a place where the system
would generate an runtime access violation if a NULL pointer were dereferenced.

It invariably confused folks who hadn't thought clearly and went to debug
their code, so as a style convention we required folks to always write "NULL" 
rather than some other equivalent in their C code to reinforce the notion 
that the null pointer isn't necessarily address 0x00000000.



More information about the Comp.lang.c mailing list