Referencing NULL pointers
Doug Gwyn
gwyn at smoke.BRL.MIL
Tue Aug 29 06:37:50 AEST 1989
In article <9838 at xanth.cs.odu.edu> kremer at cs.odu.edu (Lloyd Kremer) writes:
> p = 0; /* integer variable that happens to be set to zero */
> data = *(int *)p; /* no constant expression in this line */
>I would think the "promotion to nil pointer" rule would not apply here.
Correct, as Chris has already pointed out. However I think there are
enough requirements imposed on converting between integers and pointers
that if you allow the above you'll also have to make the null pointer a
funny bit pattern, with resulting higher overhead than most people would
think necessary in that environment. I don't have a formal proof though..
More information about the Comp.lang.c
mailing list