diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index ccb44ac9..b21bf08a 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -966,6 +966,10 @@ and must be defined for all translation units in the program, including Boost li This macro will no longer have any effect once an official Microsoft release supports the CTP features. ]] +[[`BOOST_NULLPTR`][ +If `BOOST_NO_CXX11_NULLPTR` is not defined (i.e. C++11 compliant compilers), expands to `nullptr`, +otherwise expands to `0`. +]] ] [endsect] diff --git a/include/boost/config/detail/suffix.hpp b/include/boost/config/detail/suffix.hpp index 2423c35d..cee5a965 100644 --- a/include/boost/config/detail/suffix.hpp +++ b/include/boost/config/detail/suffix.hpp @@ -1069,6 +1069,12 @@ namespace std{ using ::type_info; } #define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST +#if !defined(BOOST_NO_CXX11_NULLPTR) +# define BOOST_NULLPTR nullptr +#else +# define BOOST_NULLPTR 0 +#endif + // // Set BOOST_HAS_STATIC_ASSERT when BOOST_NO_CXX11_STATIC_ASSERT is not defined // diff --git a/test/helper_macro_test.cpp b/test/helper_macro_test.cpp index 79549ca3..b90b3ef4 100644 --- a/test/helper_macro_test.cpp +++ b/test/helper_macro_test.cpp @@ -62,6 +62,10 @@ struct trait enum { value = b }; }; +void* test_nullptr() +{ + return BOOST_NULLPTR; +} int main() { @@ -82,6 +86,8 @@ int main() { result += 2; } + + test_nullptr(); } catch(int) {