Boost logo

Boost :

Subject: Re: [boost] [config] Positive feature macros, r2
From: P F (pfultz2_at_[hidden])
Date: 2018-01-26 15:00:04


> On Jan 25, 2018, at 11:39 AM, Peter Dimov via Boost <boost_at_[hidden]> wrote:
>
> Steven Watanabe wrote:
>
>> I'm opposed to this, as I believe that it simply creates pointless churn. I consider the proposed benefits to be utterly insignificant.
>
> It does not bother you that when adding a feature macro one needs to remember to add it to all compiler configurations, live or dead? And that if one forgets nobody is any the wiser?
>
> It does not bother you that we can't just add
>
> #if defined(__cpp_foo) && __cpp_foo >= 201400
> # define BOOST_CXX14_FOO
> #endif
>
> in one place and have it mostly work, instead of touching O(N) files?

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.


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