offsets in structures.

Guy Harris guy at rlgvax.UUCP
Sat Oct 20 17:09:53 AEST 1984


> What more does using special "nil" get you than using a 0, apart from
> hardware check against dereferencing NULL?  In any case, the hardware
> check is unnecessary if you write your code correctly.  Are we all
> hackers or are there some professional programmers out there?

Assuming you are handed an existing machine and an existing OS, libraries,
and language tools with hardware and/or software conventions assigning a non-zero
value to a null pointer, it gets you compatibility between a C implementation
done for that machine and the other languages on that machine.  If the hardware
check is already there, one might as well use it.  There's plenty of crap
code out there - in standard versions of UNIX - that *does* dereference null
pointers; hardware/software that catches it can help flush it out.  We
discovered this in our port to our 68000-based micro, which shoots down
null pointer dereferences for reasons other than checking code.  Also note
that even the best programmers do not produce 100% perfect code every time;
no amount of methodology or care can eliminate all errors, as the programmer
could easily err in applying their checks as easily as they err in producing
code.

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



More information about the Comp.lang.c mailing list