"P F" wrote:
#if defined(__cpp_foo) && __cpp_foo >= 201400 # define BOOST_CXX14_FOO #endif
I think it would be better to define the positive macros like this:
#ifndef BOOST_CXX14_FOO #if defined(__cpp_foo) && __cpp_foo >= 201400 # define BOOST_CXX14_FOO 1 #else # define BOOST_CXX14_FOO 0 #endif #endif
This way:
- We get a warning when checking the macro when it hasn’t been defined properly - The user can easily override the value with `-DBOOST_CXX14_FOO=0` during compilation because a feature turns out to be buggy.
As written, this does not allow the latter. The general case is: // prefix.hpp: #if defined(__cpp_foo) && __cpp_foo >= 201400 # define BOOST_CXX14_FOO #endif // compiler/bar.hpp: #if __BAR_VERSION__ >= 12 && __BAR_VERSION__ < 18 // have foo, don't have feature macros yet # define BOOST_CXX14_FOO #endif #if __BAR_VERSION__ == 21 && __cplusplus >= 201700 // bar++ version 21 has a bug in foo in -std=c++17 mode # undef BOOST_CXX14_FOO #endif If you define to 0 or 1 in prefix.hpp, the information of whether the user overrode is lost, and the compiler-specific config can still stomp over the user define. I think that Boost.Config already offers a few mechanisms for the user to override, they're not as simple as a define on the command line though.