From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-07-10 06:05:16
Edward Diener wrote:
> It would be much easier, and less confusing, when looking at compiler
> workarounds in Boost code if their were defines for various
> compilers/versions in a configuratiion header file such as:
> #define BOOST_COMPILER_SOME_COMPILER_LOWER (PREPROCESSOR_TAG >= nnnn)
> #define BOOST_COMPILER_SOME_COMPILER_UPPER (PREPROCESSOR_TAG <= nnnn)
> #define BOOST_COMPILER_SOME_COMPILER (BOOST_COMPILER_SOME_COMPILER_LOWER
> && BOOST_COMPILER_SOME_COMPILER_UPPER)
> where SOME_COMPILER might be VC71,GCC40 etc.
> Then in code one could see:
> #if defined(BOOST_COMPILER_VC71) etc.
> rather than the less understandable
> #if defined(MSC_VER == nnnn) etc.
> I would just like to see more readability in the Boost code regarding
> compiler workarounds. I am also aware their is a workaround macro, but
> even that deals in compiler preprocessor tags rather than a more
> readable compiler version. I am aware that many workarounds have to deal
> with versions before or after a certain version number but even that can
> be made more readable by macros which tell one the actual compiler which
> is involved.
> I realize I am just a reader of Boost code and not a Boost developer but
> I think this suggestion would make for a little more readable code in
> its own small way.
How about these?
#define BOOST_COMPILER_WITH_VERSION(compiler,version) \
(compiler == version)
#define BOOST_COMPILER_ABOVE_VERSION(compiler,version) \
(compiler > version)
#define BOOST_COMPILER_FROM_VERSION(compiler,version) \
(compiler >= version)
#define BOOST_COMPILER_BELOW_VERSION(compiler,version) \
((compiler != 0) && (compiler < version))
#define BOOST_COMPILER_UP_TO_VERSION(compiler,vesionr) \
((compiler != 0) && (compiler <= version))
#define BOOST_COMPILER_FROM_TO_VERSION(compiler,min_version,max_version) \
((compiler != 0) && ((compiler >= min_version) && (compiler <= max_version)))
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk