Boost logo

Boost :

From: Andrey Melnikov (melnikov_at_[hidden])
Date: 2005-07-15 12:08:04


Rob Stewart wrote:
> From: "Jonathan Turkanis" <technews_at_[hidden]>
>
>>You could also do
>>
>> BOOST_WORKAROUND(GCC, LESS(3,2,3))
>> BOOST_WORKAROUND(GCC, LESS_EQ(3,2,3))
>> BOOST_WORKAROUND(GCC, TESTED_AT(3,2,3))
>> ...
>
> You could also simplify the "LESS," "LESS_EQ," etc. operators
> with the common abbreviations: LT, LE, GT, GE, and even EQ.
>
Common in which world? Perl, HTML entities, assembler? I think that
somebody will decipher LE as LEss instead of Less or Equal.

We aren't going to reduce or to increase the size. We just want to
increase clarity for plain users. I like

BOOST_WORKAROUND_TESTED_AT(GCC, 3,2,3)

What about

BOOST_WORKAROUND_BEFORE(GCC, 3,2,3)
BOOST_WORKAROUND_AFTER(GCC, 3,2,3)
BOOST_WORKAROUND_STARTING_FROM(GCC, 3,2,3)

and other plain English words instead of syntactic tricks with putting <
signs as macro parameters? Is it going to be more verbose and cryptic
than using macrost with < ?

Here are real life examples from intrusive_ptr.hpp and mem_fn.hpp:

#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__,
BOOST_TESTED_AT(0x3003))

#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) &&
!BOOST_WORKAROUND(__MWERKS__, < 0x3200)

How we are going to transform the latter?

#if !BOOST_WORKAROUND_BEFORE(MSVC, 8,0,0) &&
!BOOST_WORKAROUND_BEFORE(MWERKS, 9,0,1)

Can we get rid of these "!" signs?

!a && !b

looks too verbose to me. But of course

!BOOST_WORKAROUND(__MWERKS__, < 0x3200)

isn't equivalent to

BOOST_WORKAROUND(__MWERKS__, >= 0x3200)

I wonder if such a change would improve readability:

#if BOOST_WORKAROUND_BEFORE(MSVC, 8,0,0) ||
BOOST_WORKAROUND_BEFORE(MWERKS, 9,0,1)
// () operator cannot be used on certain compilers
#else
     R & operator()(T & t) const
     {
         return (t.*f_);
     }
#endif

Andrey


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