Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-02-18 11:26:48


> Many of the regression tests for the date time library are failing
> currently because the library relies on std::abs<long long> being
> available. AKAIK, the C++ standard doesn't require this so the library
> shouldn't make use of it.
>
> Maybe datetime should specify it's own version of abs like this:
>
> #include <cstdlib>
> #include <stdlib.h>
>
> template <typename T> T abs(T i) { return std::abs(i); }
> template <> long long abs(long long i) {return ::llabs(i); }

Take a look at bosot/date_time/compiler_config.hpp which
does something similar. All we need to do to fix these regressions
is add the compiler to the list of those that don't have std::abs
at line 34. Turns out that some compilers that support long long
do define a version of abs for long long. (I'm sure you also
know that some compilers don't call it the type long long
either which is why we have boost::int64_t).

Just as an aside, at some point this logic should likely
move out of date_time and into the general config somewhere
so that others can access std::abs on these types if they
need.

Jeff


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