gcc and NULL function pointers.

Doug Gwyn gwyn at smoke.brl.mil
Sat Jun 22 14:37:24 AEST 1991


In article <C62C9-2 at xds13.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:
>> What about systems where different pointer types have different sizes?
>Then a different definition of NULL is appropriate.

NO NO NO.  There is NO appropriate definition of NULL if your criterion
be that it "work" without proper casting.  If you declare it as, say,
something that will work as an int*, then it cannot work as a char* on
a system where different pointer types have different sizes.

In other words, the problem you think you're trying to solve cannot be
solved in general.  As I said, you do nobody a favor when you make the
programmer think that he doesn't need to be careful (because your
implementation will "fix" his sloppiness).

All this stuff was thoroughly discussed in X3J11, by the way.  The
outcome was what you now see specified in the C standard.



More information about the Comp.std.c mailing list