Boost logo

Boost :

Subject: Re: [boost] [config] Macro for null pointer
From: Daniel Russel (drussel_at_[hidden])
Date: 2012-12-07 15:14:31


> Well, I think some individuals here (I'd put myself in that camp) are
> opposed to injecting anything into the global namespace if it can be
> helped, and here it certainly can be helped. So if we add a nullptr
> emulation in Boost, it's going to have to be paired with a using macro, a
> different name (i.e., boost::nullptr_), or both. If no one will use this
> utility given the latter imperfections, I'm fine with just dropping the
> proposal altogether and everyone can go back to using NULL or C++11.
Just to put in my vote for not putting anything in the global namespace but providing a "BOOST_USING_NULLPTR" macro. We keep our nullptr emulation in our library namespace too and would gladly switch to a boost one.

For use cases, distributed libraries that have a namespace can just use the macro to pull nullptr into their namespace and non-distributed libraries or executables without namespace can safely use the macro to pull it into the global namespace (since they know their environment). This is, in general, one line of code for the whole project if you stick it in the config header. The only problematic case are distributed C++ libraries that don't have a namespace. But I'm fine making those do more awkward things as it is bad practice and, I think, not that common any more.
  --Daniel


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