C++ definition of NULL

Tomislav Goles tom@ait-tech.com
Wed Mar 3 07:52:00 GMT 1999


> > 
> > The C++ committee blew this one.
> 
> It seems we disagree. If the committee wanted to introduce a reserved
> name for the null pointer constant, NULL definitely would have been a
> bad choice, because people have all kinds of views what NULL is
> (including (void*)0 and (char*)0). Also, people just *know* that NULL
> is a macro. The way NULL is defined really reflects all this confusing
> tradition, and is a bad start for defining a clean concept of 'null
> pointer'.
> 
> I'm not sure how much readability is lost in a language if the null
> pointer constant is removed. I found that people typically understand
> very quickly that the right way to express a null pointer is to write
> '0'. This is especially true since this constant needs all kinds of
> funny polymorphic properties. Explaining that a conversion is going on
> to the specific type required is much easier when you see that you
> start off with a number literal.
> 

I happen to agree with Martin. But even if I did not I still think NULL
should be removed because the committee (rightly or wrongly) decided so.
Any complaints about this decision I think should be directed to
the committee. In the mean time, egcs would be better off being compliant
and doing away with NULL unless the committee decides to overrule itself.

Tomislav Goles


More information about the Gcc mailing list