An Ubiquitous C bug
Zev Sero
zvs at bby.oz.au
Tue Jan 22 13:40:46 AEST 1991
Peter = hpa at casbah.acns.nwu.edu (Peter Anvin)
Peter> Should NULL be all ones? Performance issues aside, such a
Peter> machine would only need to subtract one when converting an int
Peter> to a pointer, and add one the other way. In constant
Peter> expressions, such as when using the macro NULL, that can of
Peter> course be done at compile time.
It would have to be done only at compile time. Fragments such as:
int x = 0;
char *p = (char *)x;
*should* point at location zero if that is a valid address on this
machine, and dereferencing it should give you whatever is at that
address. *Only* constant expressions evaluating to zero (such as the
macro NULL) represent the null pointer, and these are determined
at compile time.
--
Zev Sero - zvs at bby.oz.au
This I say unto you, be not sexist pigs.
- The prophetess, Morgori Oestrydingh (S.Tepper)
More information about the Comp.lang.c
mailing list