[net.bugs.4bsd] NULL pointer

mrm@datagen.UUCP (01/19/84)

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

guy@rlgvax.UUCP (01/21/84)

Several flavors of UNIX - including Sun's 4.2BSD - also disallow dereferencing
null pointers.  Nothing in UNIX says 0 must point to something real, so
people shouldn't write programs that assume you can dereference zero, much
less get something meaningful by doing so.  Period.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy