Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-07-13 13:15:28


From: Tobias Schwinger <tschwinger_at_[hidden]>
> 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__)

s/BOOST_GCC_VERSION/BOOST_VERSION/

> Example:
>
> #if BOOST_WORKAROUND(BOOST_GCC,< BOOST_VERSION(3,2,3))
> // ...
> #endif

It's a nice idea which neatly circumvents the octal problem and
the N digit problem. BOOST_VERSION could be updated at any time
to handle a compiler that used more digits. For now, the
multipliers could be 10000 and 100.

To use BOOST_VERSION, however, all compilers would need a
BOOST_XXX macro that encodes the native version number into a
BOOST_VERSION-compatible number. For GCC, that would be
BOOST_GCC as shown above. For MSVC, it would be more painful,
but still tenable, I think.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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