Boost logo

Boost :

Subject: Re: [boost] [config] Macro for null pointer
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-12-05 22:42:55


On Wed, Dec 5, 2012 at 12:16 PM, Andrey Semashev
<andrey.semashev_at_[hidden]>wrote:

> On December 5, 2012 10:50:41 PM Eric Niebler <eric_at_[hidden]> wrote:
>
[...]

> I for one will simply be using 0 in code that needs to be portable. I
>> don't feel the need for anything fancier.
>>
>> I might consider using a BOOST_NULLPTR macro if it were defined like this:
>>
>> #if c++11 // <-- psuedo-code
>> #define BOOST_NULLPTR nullptr
>> #else
>> #define BOOST_NULLPTR 0
>> #endif
>>
>
> If the alternative is to always use BOOST_USING_NULLPTR, I would probably
> agree, except that I would use NULL instead of 0.
>

At that point, might as well use boost::nullptr (or whatever you want to
call it) instead of either NULL or 0.

Or, as Nathan suggested, drop trying to emulate the literal nullptr keyword
and just define and use boost::nullptr_. That's probably the best option.
Slightly uglier, but no macros and no name collisions.

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk