negative addresses

Wayne A. Christopher faustus at ic.Berkeley.EDU
Wed May 18 17:28:08 AEST 1988


In article <10001 at tekecs.TEK.COM>, andrew at frip.gwd.tek.com (Andrew Klossner) writes:
> >> Unfortunately, it is a real problem, because there are zillions of
> >> programs that implicitly assume that [null] pointers are all-zeros.
> 
> 		if (tbuf->c_ptr)

The trick here is that whenever a pointer is converted into an
integer (as here), the NULL pointer must be converted to the integer
0.  It doesn't matter what the bit pattern is before conversion.
Otherwise, as you say, the world would be swallowed up by huge
tidal waves and the sun would fall from the sky.  Are there any
implementations of C that use a non-0 bit pattern?  I pity the
compiler writer...

	Wayne



More information about the Comp.lang.c mailing list