Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-01-27 13:30:14


On Fri, 24 Jan 2003 11:53:15 -0500, David Abrahams
<dave_at_[hidden]> wrote:

>Here are three ways to spell it:
>
> 1...
>
> 2 #if BOOST_WORKAROUND(
> __BORLANDC__, BOOST_TESTED_AT(0x561) && __BORLANDC__ >= 0x561)
> 3...

Though it works in some cases, I would generally advise against
combining BOOST_TESTED_AT with other tests in the same
BOOST_WORKAROUND invocation. The problem is that the current
implementation is parenthesis "unguarded". For instance (when
BOOST_DETECT_OUTDATED_WORKAROUNDS is defined) the above yields the
following

   symbol test part:

   (__BORLANDC__ > 0x561) ?(-1): ( 1 && __BORLANDC__ >= 0x561)

As you can see the second condition is and-ed with 1, not with
BOOST_TESTED_AT altogether. That's not a problem in this specific case
but, IMHO, it's better not to run any risk.

P.S.: The parentheses around 1 && __BORLANDC__ >= 0x561 above come
from the BOOST_OPEN_PAREN hack (see implementation) but they are not
the cause of the problem. Without them you would have

   (__BORLANDC__ > 0x561 ?(-1): 1 && __BORLANDC__ >= 0x561)

which has the same binding, because of operator precedence.

Genny.


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