This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [C++0x] nullptr
- From: Magnus Fromreide <magfr at lysator dot liu dot se>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Ed Smith-Rowland <3dw4rd at verizon dot net>, gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Mon, 03 May 2010 08:08:35 +0200
- Subject: Re: [C++0x] nullptr
- References: <1268546192.2028.32.camel@sara.home> <4BA46E77.6080507@redhat.com> <1269813166.2249.8.camel@sara.home> <4BB12B74.80703@redhat.com> <4BDD0915.2020301@redhat.com> <1272842221.2000.26.camel@sara.home> <4BDE597C.30609@verizon.net> <4BDE6283.1070804@redhat.com>
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