Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-07-16 14:08:07


Andrey Melnikov <melnikov_at_[hidden]> writes:

> David Abrahams wrote:
>> Andrey Melnikov <melnikov_at_[hidden]> writes:
>>
>> Just about every other token in
>>
>> BOOST_WORKAROUND(GCC, >, 3,2,3)
>>
>> is trickier than the ">".
>
> I didn't mean a preprocessor trick. I only mean that for people it's
> unusual to see ">" sign alone or in an "unary" notation like "> 030203".
> They will have to look at the macro itself to see how this ">" works.

That goes double for all the other arguments to BOOST_WORKAROUND.

>> The desire to spell out comparison operations as english words seems
>> akin to the desire to embed compiler/ide versions in macro names.
>>
> It really is akin. I'd like to see something more transparent and
> intuitive. I don't like the idea with words very much, but I don't like
> ">" s

I'm sorry; I can't imagine what could be more intuitive and
transparent than using ">" to mean "is greater than."

>> #if !BOOST_WORKAROUND(MSVC, <=, 7,0,0) && !BOOST_WORKAROUND(MWERKS, <, 9,0,0)
>>
>>
>>>Can we get rid of these "!" signs?
>>>
>>>!a && !b
>>>
>>>looks too verbose to me.
>>
>>
>> You can always write:
>>
>> #if !(BOOST_WORKAROUND(MSVC, <=, 7,0,0) || BOOST_WORKAROUND(MWERKS, <, 9,0,0))
>>
>> but it's not much better.
>
> Do you think an empty branch and #else is worse than "!" ?

Yes, a little bit worse. It looks like someobody made a mistake and
left out the #if clause.

> Negations are rather hard to decipher.

Some "problems" don't need to be solved, IMO, and the supposed
inability of some programmers to read C++ logical expressions is one
of them.

> #if BOOST_WORKAROUND(MSVC, <=, 7,0,0) || BOOST_WORKAROUND(MWERKS, <, 9,0,0)
> // these compilers doesn't support these features
> #else
> // actual code for cases when no workarounds are nesessary
> #endif
>
> I always decode the former expression to the latter in my mind. I think
> #else is a better way to express a negation than "!" in this case.

Why?

-- 
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