Boost logo

Boost :

Subject: Re: [boost] [config] Macro for null pointer
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2012-11-16 07:51:02


Antony Polukhin wrote
> 2012/11/16 Jeffrey Lee Hellrung, Jr. <

> jeffrey.hellrung@

> >:
>> On Thu, Nov 15, 2012 at 7:04 PM, Edward Diener <

> eldiener@

> >wrote:
>>
>>> I have found something like this to be helpful, when working with
>>> multiple
>>> compilers:
>>>
>>> #include <boost/config.hpp>
>>> #if defined(BOOST_NO_NULLPTR)
>>> #define BOOST_XXX_NULLPTR 0
>>> #else
>>> #define BOOST_XXX_NULLPTR nullptr
>>> #endif
>>>
>>> where XXX is some local name for my own use. And then use
>>> BOOST_XXX_NULLPTR in places where a null pointer is needed.
>>>
>>> Would this be a candidate for a BOOST_NULLPTR macro in the config
>>> library
>>> instead ?
>>>
>>
>> Might it be better to just offer a (albeit imperfect) nullptr emulation
>> if
>> not supplied by the compiler? For example, [1].
>>
>> - Jeff
>>
>> [1] http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/nullptr
>
> `nullptr_t` is also required for libraries (especially for
> Boost.SmartPtr). So there must be a macro for it too.
>
> And may be we shall typedef nullptr_t as boost::none_t ?

Why a library will need a type nullptr_t while there is only a constant in
C++11? Please coul you elaborate?

Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/config-Macro-for-null-pointer-tp4638690p4638730.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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