[cfe-dev] Objective-C and C++0x nullptr

David Chisnall theraven at sucs.org
Mon May 30 04:46:50 PDT 2011


On 30 May 2011, at 12:07, Jonathan Sauer wrote:

> while naively replacing NULL with nullptr in my code, I stumbled upon the following.

You shouldn't need to do that.  NULL should be a #define for nullptr in C++ 2011 mode, or for something more relevant to the language settings in other modes.

> Now, nullptr is a C++0x constant, and NSOpenGLPixelFormat is an Objective C class, but a pointer
> to it is still a pointer and thus should be comparable against nullptr.
> 
> I think. Although I don't think the interaction between Objective-C and C++0x has been defined
> (yet).
> 
> What do *you* think?

I would expect it to behave in exactly the same way as GCC's __null (which is what NULL currently expands to for me), which can be assigned to Objective-C pointers.  I'm a little bit surprised that it doesn't...

David

-- Sent from my IBM 1620





More information about the cfe-dev mailing list