negative addresses

Philip Kos phil at osiris.UUCP
Fri May 20 05:47:50 AEST 1988


In article <4086 at gryphon.CTS.COM>, sarima at gryphon.CTS.COM (Stan Friesen) writes:
> In article <10001 at tekecs.TEK.COM> andrew at frip.gwd.tek.com (Andrew Klossner) writes:
> > There doesn't seem to be leeway
> >to define pointer comparisons to be against some non-zero NULL value.
> 
> 	Yes, but they ALSO require that comparing a NULL-pointer to zero
> evaluate to true *whatever* the representation of the NULL-pointer....

Please be careful not to confuse null pointers with NULL pointers.  Null
pointers have a formal definition within the language, but NULL pointers
don't really; NULL is just a convention and not part of the language spec.
("We write NULL instead of zero, however, to indicate more clearly that
this is a special value for a pointer", K&R first edition, pp. 97-98; "The
symbolic constant NULL is often used in place of zero, as a mnemonic to
indicate more clearly that this is a special value for a pointer", K&R
second edition, p. 102.)

I've also seen NULL defined as (char *) 0, by the way...


                                                                 Phil Kos
                                                      Information Systems
...!uunet!pyrdc!osiris!phil                    The Johns Hopkins Hospital
                                                            Baltimore, MD



More information about the Comp.lang.c mailing list