Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-12-06 14:16:39


I've just checked in boost/detail/workaround.hpp, which defines the
BOOST_WORKAROUND macro.

This macro can and should be used in place of explicit tests for
particular compiler/library/platform versions.

I've also gone through and replaced all the explicit tests in
boost/iterator_adaptors.hpp with uses of BOOST_WORKAROUND, as a
proof-of-concept.

One thing I really noticed, which I've been meaning to mention here
for a long time: we used to have an informal policy that
non-workaround code should appear first, e.g.:

# if !broken-compiler
   // normal code
#else
   // workaround code
#endif

That approach never scaled well (what if you have multiple workarounds
for different compilers?) and it works even less-well now. you have to
write

# if !BOOST_WORKAROUND(version, <= old_version)
   ...

But the BOOST_WORKAROUND macro is much clearer when it announces the
workaround code, not the regular stuff. So I suggest that we give in
to reality and put the workaround code at the bottom of the chain of
#if directives.

-Dave

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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