
7 Nov
2008
7 Nov
'08
12:09 p.m.
MSCV8 gives this warning when compiling Boost.Regex 1.37.0 under Windows x86 (32 Bit): libs\regex\src\..\src\cregex.cpp(563) : warning C4309: 'static_cast' : truncation of constant value The code that produces the warning: #ifdef BOOST_HAS_LONG_LONG const std::size_t RegEx::npos = static_caststd::size_t(~0ULL); #else const std::size_t RegEx::npos = static_caststd::size_t(~0UL); #endif In Windows x86 sizeof(unsigned long long int) is 8, sizeof(std::size_t) is 4 and BOOST_HAS_LONG_LONG is defined. Therefore "~0ULL" is truncated from 8 to 4 bytes. Maybe a better trigger would be the architecture (32 Bit or 64 Bit) since in all environments I know sizeof(std::size_t) equals the architecture. Regards, Peter.