the nil pointer is not zero

Doug McDonald mcdonald at aries.scs.uiuc.edu
Sun Nov 18 13:41:51 AEST 1990


In article <14516 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>In article <164 at nazgul.UUCP> bright at nazgul.UUCP (Walter Bright) writes:
>
>-I think the ANSI C committee missed the boat on this. Thousands of hours
>-of wasted time, confusion, and net debate would have been eliminated if
>-NULL had been fixed at all bits 0.
>
>I don't think so.  What good would it do you to know how a null pointer
>is represented?  There is nothing useful you can do about that.


The point is that if it were indeed actually all bits zero, in all
contexts, period, and so that you could not, for example, 
say,

char *i;
int j;
scanf("%d",&j);
i = (char *) j;

and end up with something other than a null pointer if you input 
0 to the scanf, then there would be a lot less discussion in comp.lang.c.

Doug MCDonald



More information about the Comp.lang.c mailing list