C++ definition of NULL

Per Bothner bothner@cygnus.com
Wed Mar 3 08:16:00 GMT 1999


> 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.

Er, removing NULL is not an option, because it is required by the standard.
Furthermore, I have not proposed that NULL not be a macro.

What I am unhappy about is the C++ committee disallowing (void*)0
as the definition of NULL.  This prevents the compiler from diagnosing
certain errors (I have no opinion on how common or damaging these
errors are), unless the compilers uses some special magic tricks.
G++ does use suchs tricks (I don't know the details), but using
(void*)0 would have been better, I think.

I am also unhappy about style guides that discourage use of NULL.

	--Per Bothner
Cygnus Solutions     bothner@cygnus.com     http://www.cygnus.com/~bothner


More information about the Gcc mailing list