Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-03-13 11:50:25


Working on the time library porting one issue that we have hit is that std::abs
is not defined for long long types on some compilers even though they support a
long long type. In particular MSVC6 and gcc2.95.x. To work around this, we
have the following code:

//Work around compilers that don't have std::abs
#if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97)|| (defined(BOOST_MSVC) && _MSC_VER
<= 1200)
namespace std
{
    long long abs(long long x)
    {
      return x < 0 ? -x : x;
    }
}
#endif

I suspect that this rightfully belongs as part of boost.config, but not being an
expert on the details I'm looking for some advice/help on whether this is
worthwhile and if so where it belongs.

Jeff


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