NULL and 0

Craig Burley burley at mole.gnu.ai.mit.edu
Fri May 17 00:29:10 AEST 1991


Another machine where NULL and 0 have different representations: The Prime
50 Series.  Assuming they implemented C NULL pointers the way all the other
languages did, NULL in C, which is "(char *) 0" or "(void *) 0", actually
has a pointer value of 07777/0, where the first number is the (octal)
segment number and the second is the word offset within the segment.

It is possible that one or more C implementations under PRIMOS used 0/0 as
NULL instead of 07777/0, but that'd probably be only to deal with old C
code that assumed that on all machines a NULL pointer had the same binary
representation as integer 0.  I'd be very surprised if the "official" or
standard way to compile C code under PRIMOS wasn't to use the 07777/0
representation for NULL, since other languages (PL/I for example) use that
representation, as do libraries and OS system calls.
--

James Craig Burley, Software Craftsperson    burley at gnu.ai.mit.edu



More information about the Comp.lang.c mailing list