Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-07-12 08:06:51


Edward Diener <eddielee_at_[hidden]> writes:

> one could create a series of macros, let us say for VC71, like this:
>
> // These are always defined and included in a header file at the top of
> select_compiler_config.hpp
>
> #define BOOST_COMPILER_VC _MSC_VER

It's a lot more complicated than that, unfortunately, because many
other compilers define _MSC_VER to "act compatible" with VC++.

> You could now say:
>
> #if BOOST_WORKAROUND(BOOST_COMPILER_VC,BOOST_COMPILER_VC71_VERSION)
> // code
> #endif
>
> or, in a different situation:
>
> #if
> BOOST_WORKAROUND(BOOST_COMPILER_VC,BOOST_TESTED_AT(BOOST_COMPILER_VC71_VERSION_HIGH))
> // code
> #endif
>
> or, in a different situation:
>
> #if BOOST_COMPILER_VC71 // and any other combinations you like
> // code
> #endif

Okay, I understand what you're driving at. I'm not sure if going down
this road is worth the trouble, but if it is, I'd rather see a
standard system for referring to versions numerically. So, for
example:

        Version Value
        ------- -----
        6.0 060000
        6.0sp5 060005
        7.0 070000
        7.1 070100
        5.3.4 050304
        3.4.3 030403
        2.95.3 029503

I don't particularly think

  BOOST_COMPILER_VC == BOOST_COMPILER_VC71_VERSION

is more expressive than

  BOOST_MSVC_VERSION == 070100

Nor do I think

  BOOST_COMPILER_VC <= BOOST_COMPILER_VC71_VERSION_HIGH

is an improvement over

  BOOST_MSVC_VERSION < 070200

> If you are arguing for only using BOOST_WORKAROUND, and never using
> a construct like the last one

Among other things, I am.

> then you are advocating always using specific version numbers.

I don't know what you mean.

> In that case you may want to consider at least forms like
> BOOST_COMPILER_VC71_VERSION and BOOST_COMPILER_VC71_VERSION_HIGH
> useful for your BOOST_WORKAROUND and BOOST_TESTED_AT macros.

I understand why you want it, but am not fond of your proposed names
and syntax.

> Of course you would have the same macros for each compiler/version

As I'm sure you know, I do think there should be a separate macro for
each compiler, explicitly #defined to 0 when that compiler is not in
use.

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