This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++0x] nullptr
On Mon, 2010-05-03 at 01:43 -0400, Jason Merrill wrote:
> On 05/03/2010 01:05 AM, Ed Smith-Rowland wrote:
> > In gcc we
> > #define NULL __null.
> > OTOH the committee thought about and ultimately rejected
> > #define NULL nullptr
> >
> > Can/should we go ahead and do this since we sort of did it already?
>
> No. NULL is defined to be an integer, which __null is and nullptr is
> not; making that change would break code. Such code probably ought to
> be broken, but it still isn't something I want to do just in G++.
>
> > If we don't want to do this would it be a good idea to have a flag
> > -fNULL=nullptr o somesuch?
>
> NULL is defined by headers, not in the compiler. Try -DNULL=nullptr if
> that's what you want?
And to mess things up further there is library issue 1314 (
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2010/n3054.html#1314 )
I have also seen code like this in the wild:
class abstract {
public:
~abstract() = NULL;
};
but it is my understanding that it already is broken due to e.g. 0L and
false being valid null pointer constants.
/MF