Boost logo

Boost :

Subject: Re: [boost] [config] Rethinking feature macros?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-11-06 17:51:23


On 11/06/17 20:02, Peter Dimov via Boost wrote:
> Andrey Semashev wrote:
>> >> g++-7 will be out of wide use by then, so it doesn't matter.
>> >
>> > That's not true on at least three levels.
>>
>> Why?
>
> Because
>
> 1. C++17 still matters even if g++-15 -std=c++17 is used instead of
> g++-7 -std=c++17;

Not sure how it relates to my point. Surely, g++-15 will have no worse
support for C++17 than g++-7, so it will not require more macros. Likely
less.

> 2. g++-7 will not be out of wide use as today we still have to care
> about g++ 4.4;

First, g++-4.4 is out of wide use currently. Second, we don't have to
care about it beyond caring about checking for Boost.Config macros,
which were defined and tested years ago. Those macros are also relevant
for other compilers, so this is not something we do specifically for gcc
4.4. Third, we test gcc 4.4 only as long as we want to. Or put it
another way, as long as there are people that want to test it. I don't
see how those people would benefit from changing macros the other way
around.

> 3. Even if a compiler is out of wide use, we still maintain Config for it.
>
> https://github.com/boostorg/config/blob/develop/include/boost/config/compiler/digitalmars.hpp

Sure, as long as we choose to. And we would still have to maintain and
test those files with positive macros.

>> >> > The good thing about positive macros is that an old compiler
>> never >> > needs maintenance. With negative macros you have to keep
>> adding them >> > to it.
>> >>
>> >> That is not more maintenance than adding positive macros for newer
>> >> compilers.
>> >
>> > It is. Maintaining the new compilers is constant regardless of the
>> macro > type, and maintaining the old compilers is only required for
>> negative > macros.
>>
>> I don't see how. You have to add new macros as they come with new C++
>> versions or someone requests them. You have to test them. All this is
>> the same amount of work regardless of whether the macro is positive or
>> negative.
>
> On an old compiler, you don't need to add new positive macros, so
> there's less work to do.

No, it's not. Either way you add a macro to gcc.hpp, visualc.hpp, etc.,
only the condition changes. Either way you need to test it, which is
arguably the most time consuming part.

> On a new compiler, you either add the positive macro to -std=c++17 or
> add the negative macro to -std=c++14 and below, so the work is the same.

As I've said earlier, I'm specifically against the naming zoo in macros.
If we switch to positive macros - fine, but then switch all of them and
deprecate the old ones. And PRs to libraries updating to the new
convention would be nice, too.


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