"Jeff Garland" <[EMAIL PROTECTED]> writes:

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

AFAICT the logic is backwards:  you should assume there's no std::abs
which works on long long and use your own function by default, only
using std::abs if the compiler is *known* to support that
extension... if it's even worth the trouble (it'll be less code to
just do the whole thing yourself).

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to