Boost logo

Boost :

From: Kris Thielemans (kris.thielemans_at_[hidden])
Date: 2003-06-04 18:35:21


Hi

I've tried to use the random.hpp header using Visual Studio C++ 6.0, and it
does not
compile. I found a message thread in the mailing list about this on VC7,
where some work-arounds were suggested. Jens then asked for feedback, and I
didn't find any feedback, so here it is...

For example, in uniform_01.hpp there is

template<class UniformRandomNumberGenerator, class RealType = double>
class uniform_01
{
//////// cut
public:
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
  BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
#endif
/////// cut

And VC6 breaks on the BOOST_STATIC_ASSERT when instantiating a
uniform_01<mt19937>.

The following suggested work-around DOES compile.
   BOOST_STATIC_CONSTANT(bool, TMPx =
!std::numeric_limits<RealType>::is_integer);
   BOOST_STATIC_ASSERT(TMPx);

The following variation does NOT compile.
   BOOST_STATIC_CONSTANT(bool, TMPx =
std::numeric_limits<RealType>::is_integer);
   BOOST_STATIC_ASSERT(!TMPx);

The following suggested work-around does NOT compile.
   typedef std::numeric_limits<RealType> TMPlimit_t;
   BOOST_STATIC_ASSERT(!TMPlimit_t::is_integer);

So far, so good you say. Just implement the first work-around.

However, I tried to instantiate uniform_01<mt19937, int> with this
work-around enabled. And guess what? VC6 does compile this STATIC_ASSERT as
well!

Just to test, I tried to use
  BOOST_STATIC_ASSERT(std::numeric_limits<RealType>::is_integer);
This actually gives an error C2059: syntax error : '>', in both cases where
RealType is an int or a double...

So, as far as I can see, there is no point in having these static_asserts
enabled on VC6, and I am defining BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
before including random.hpp.

All the best

Kris Thielemans
Imaging Research Solutions Ltd


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