Login  Register

Some trouble with qldefines.hpp

Posted by Nicolas Di Césaré on Oct 31, 2001; 2:40am
URL: http://quantlib.414.s1.nabble.com/Some-trouble-with-qldefines-hpp-tp1787.html

Hi all,

I have some trouble with numeric_limits<>::max() under visual C++. It conflicts
with macro max. I am not able to provide a simple example where it occurs but
it seems to work with the following changes (the whole file is in attachement):

#if defined HAVE_LIMITS
    #include <limits>
    #define QL_MIN_INT      (int)(std::numeric_limits<int>::min)()
    #define QL_MAX_INT      (int)(std::numeric_limits<int>::max)()
    #define QL_MIN_DOUBLE  -(double)(std::numeric_limits<double>::max)()
    #define QL_MAX_DOUBLE   (double)(std::numeric_limits<double>::max)()
    #define QL_EPSILON      (double)(std::numeric_limits<double>::epsilon)()
    #define QL_MIN_POSITIVE_DOUBLE  (double)(std::numeric_limits<double>::min)()
...


I have also done the test with Intel C++ (visual studio pluggin) and I don't
have any  trouble.

Thus, I believe that it's visual C++ problem ...





--
Nicolas Di Césaré
http://acm.emath.fr/~dicesare

qldefines.hpp (13K) Download Attachment