Must a NULL pointer be a 0 bit pattern?

Graham Ross grahamr at azure.UUCP
Thu Nov 1 03:51:46 AEST 1984

Three comments about non-zero NULL:

1. Because of implicit comparison with zero, as in "while(p)s;", this idea
is cannot be implemented simply by changing stdio.h to read
#define NULL ((char*)0x87654321)

2. In making changes to the compiler, this must remain zero:
	(p = NULL , (int)p)
Also, for every declared "var", this must remain one:
	(p = &var , (int)p != 0)

3. The issue of how a union can be set to zero was handled properly by the
correspondent who said the first member is initialized to zero.  A further
note might be made that exec(2) need not know where to put the 0x87654321
patterns; crt0 or something emitted by the linker can do this, but perhaps
with a substantial amount of work and/or abandonment by Unix of the
"common model" for linking.

	Graham Ross, Tektronix, ...!tektronix!tekmdp!grahamr

More information about the Comp.lang.c mailing list