Boost logo

Boost :

Subject: Re: [boost] [config] Rethinking feature macros?
From: Peter Dimov (lists_at_[hidden])
Date: 2017-11-06 21:55:34


Andrey Semashev wrote:

> Dead compilers are not the problem.

Okay, I guess. This was my first argument in favor of positive macros, that
old compilers would require no maintenance.

My second argument in favor of positive macros was that they degrade more
gracefully when one is using an older Boost.Config. This happens in several
scenarios; first, in the course of normal development, when your library
needs a macro but Boost.Config doesn't have it yet; second, when you merge
to master but Config hasn't been merged yet; third, when a user upgrades
your library in an older Boost release to take advantage of bugfixes.

Since your typical code is something like

    // old things

    #if (new feature is available)

    // new things

    #endif

with a positive macro and an older Config the new things don't get included
even when the compiler supports the new feature, which leaves the user not
worse than before.

With a negative macro, the new portion is compiled and errors out when the
compiler does not support the new feature.

Steven correctly points out that this is not necessarily a benefit as it
allows one to forget to include Config (or perhaps allows new code to pick
up an old Config via a system include instead of the correct one?)

But from where I sit, this seems an acceptable tradeoff.

Either way, judging by the reaction and the arguments offered, a switch to
positive macros would be unlikely at this time. :-)


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