Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-08-16 10:00:51

Michael Stevens wrote:
> The 'random_test' has been failing on GCC-3.3 for quite some time...
> Looking a bit deeper the failure was rather nasty resulting in a infinite
> recursion. A lot of waist CPU and memory usage when running regression tests!
> The problem is GCC-3.3 specific and cause by a compiler bug. It was
> inadvertently introduced by Eric minmax workarounds.
> Specificly the 'max' member functions of class ruetti_gen in
> "random_test.cpp" and class rand48 in "linear_congruential.hpp" were defined:
> result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const
> { return (std::numeric_limits<result_type>::max)(); }
> Amazingly these are recursing, with max calling itseld rather then the correct
> max from numeric_limits! I have committed a fix which uses a different syntax
> thus:
> result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const
> { return std::numeric_limits<result_type>::max
> Eric, is this correct from a minmax macro point of view?

Yes, this is fine. But I'm amazed the compiler got it wrong the first
time. (/me scratches his head and looks perplexed.)

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at