|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-07-14 11:16:50
David Abrahams <dave_at_[hidden]> writes:
> Tobias Schwinger <tschwinger_at_[hidden]> writes:
>
>> Jonathan Turkanis wrote:
>>>
>>> The ability to accommodate these unlikely scenarios has to be balanced against
>>> usability. If a test for GCC with major version < 3 has to use "3000000,"
>>> chances are good that a test will be misspelled and a needed workaround will not
>>> be applied.
>>>
>>
>> It is possible to put an expression to calculate the 3000000 in this case into a
>> macro:
>>
>> #define BOOST_VERSION(major,minor,patchlvl) \
>> (major * 1000000 + minor * 1000 + patchlvl)
>>
>> #define BOOST_GCC \
>> BOOST_GCC_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
>>
>> Example:
>>
>> #if BOOST_WORKAROUND(BOOST_GCC,< BOOST_VERSION(3,2,3))
>> // ...
>> #endif
>
> Or we could arrange to write:
>
> #if BOOST_WORKAROUND(BOOST_GCC,< 3,2,3)
Nobody likes that one?
What about:
#if BOOST_WORKAROUND(GCC,< 3,2,3)
Pretty succinct, I think.
I'm not sure about getting BOOST_TESTED_AT to work here.
#if BOOST_WORKAROUND(GCC, BOOST_TESTED_AT 3,2,3)
would be nice syntax, but I'm just not sure how workable it is. We
may end up with
#if BOOST_WORKAROUND_TESTED_AT(GCC, 3,2,3)
which is actually pretty nice and requires fewer fancy tricks to
implement.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk