if(p)

Henry Spencer henry at utzoo.UUCP
Thu Oct 24 03:19:43 AEST 1985


> Question: isn't this all rather moot? I mean, what sort of architecture could
> you actually run 'C' on that doesn't allow the use of zero as a null pointer?
> If nothing else you can always add a shim at 0000:0000 (or whatever weird
> method you use for indicating segments)...

Shame on you Peter, for not reading the entire net.lang.c archives before
asking this question :-).  Some while ago this very issue was raised:  some
poor people were faced with implementing C on an architecture which did
interesting things with the high-order bits of pointers, such that any
attempt to treat an all-0 value as a pointer caused a trap.  Not just any
attempt to follow the pointer, mind you, but any attempt to do *anything*
with it.  Trapping *NULL is one thing; trapping foo=NULL is unacceptable.
So they could not use all-0 as NULL.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list