NULL pointer

mrm at datagen.UUCP mrm at datagen.UUCP
Fri Jan 20 01:48:57 AEST 1984


Ah yes, the NULL pointer -- some versions of C on the 68000 treat int's as
16 bits, while pointers are 32 bits, so just passing 0, without casting it
will give you the incorrect results/memory dump you deserve.  Also, some
machines (such as the PRIME, DEC10, etc.), have longer char * pointers than
say int * pointers, so you have to cast the pointer correctly (on the
Data General MV machine, which I write a C compiler for, we have a different
format for char * pointers, as opposed to int * -- but the NULL pointer has
the same representation under both).

Also, while I'm talking about the NULL pointer, various operating systems
and/or machines (such as VMS, AOS/VS, etc.) that C code gets run on these
days also do not allow the NULL pointer to be dereferenced (`*'), so code
that assumes *(char *)0 gives a 0 back will abort.  Other implementations
(such as some versions of Whitesmith's) put the copyright notice at location
0, or anything else the linker desires.

	Michael Meissner
	Data General Corporation
	4400 Computer Drive
	Westborough, Mass. 01580
	...{ allegra, decvax!ittvax, rocky2 }!datagen!mrm



More information about the Comp.bugs.4bsd.ucb-fixes mailing list