From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2003-02-03 14:38:40
Hi Michael (hi Kresimir, hi Julius, hi all ;-),
> I have come across this problem before. The same problem occured when I
> was working on .NET patches for boost::quaternion.
So there's at least another boost library affected.
> The following is from memory of VC7, so actual names may be slightly
> different. I no longer have access to the MSVC compilers. Luck me!!
> If turn on compiler warning level 3 you should see warnings for line
> such as "abs(1.5)" that a double is being converted to and integer.
> If look in the <math.h> header you will see why All the C++ definitions
> are in there. The problem is that many (includeing abs(float/double) are
> NOT defined when the macro _MSC_EXTENSIONS is defined. This is for some
> stupid backwards compatibilty with their previous broken headers!!
> To make things work, you must either
> Use the compiler switch /Za to disable microsoft extensions.
> OR use
> #ifdef _MSC_EXTENSIONS
> #undef _MSC_EXTENSIONS
> #include <cmath>
> #define _MSC_EXTENSIONS
> #include <cmath>
> I do not recommend /Za. The compiler has even more problems then normal
> when it is set. VC7 cannot compile uBLAS and many other boost libraries
> with /Za.
This agrees with Julius' statements.
> My long term solution was simply to edit <math.h> to remove the
> offending conditional compilation!
> The is no specific solution in boost/config for this problem. I don't
> see there is an easy fix either as _MSC_EXTENSIONS needs to be define
> for some of MS own header files.
OK. I've prepared the following patch for ublas:
- Add the following to the MSVC section of ublas/config.hpp
- Change the problematic parts of ublas/traits.hpp to
#if defined (BOOST_NO_STDC_NAMESPACE) || defined (BOOST_UBLAS_NO_CMATH)
return ::fabsf (t);
return std::abs (t);
I'll commit this later, if noone objects.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk