
Jeffrey Lee Hellrung, Jr.-2 wrote
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 ?
+1.
Might it be better to just offer a (albeit imperfect) nullptr emulation if not supplied by the compiler? For example, [1].
[1] http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/nullptr
There are two levels that can be addressed by different approaches: * write portable code that uses C++11 nullptr when available and 0 otherwise. * write portable code that uses C++11 nullptr when available and something safer than 0 or NULL is used to represent a null pointer otherwise. The PO proposal corresponds to the first level, whilc IMO is already interesting. The more elaborated proposal corresponds to the second need. I will be for a direct inclusion of the BOOST_NULLPTR macro as part of the Boost.Config helpers, and why not accept a specific nullptr implementation if someone is ready to maintain it. Best, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/config-Macro-for-null-pointer-tp4638690p4... Sent from the Boost - Dev mailing list archive at Nabble.com.