Re: [boost] lexical_cast issues under Tru64 Unix

Alexander Nasonov wrote:
Does it mean that your std library doesn't define compile-time contants in std::numeric_limits<T> ?
It does define std::numeric_limits<T>. Something more subtle must be wrong. If I preprocess and compile like this ... % cxx -E -std strict_ansi -tlocal -Iboost include_lcast_precision.cpp | grep -v '^#line ' > z_pp.cpp % cxx -c -std strict_ansi -tlocal z_pp.cpp I get the error below. Does this give a clue? More observations: - cxx 6.5 = EDG 245 - cxx 7.1 = EDG 304 - We also have MIPSpro 7.41 = EDG 245, which doesn't have a problem (but boost.config may work around it in some way...?). cxx: Error: z_pp.cpp, line 20976: constant value is not known typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !is_specialized_binary || digits < 18446744073709551615U / 30103UL && precision > limits::digits10 + 0UL && precision <= precision_maxarg + 0UL ) >)> boost_static_assert_typedef_63; ----------------------------------------------------------------------------------------------------^ cxx: Error: z_pp.cpp, line 20976: incomplete type is not allowed typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !is_specialized_binary || digits < 18446744073709551615U / 30103UL && precision > limits::digits10 + 0UL && precision <= precision_maxarg + 0UL ) >)> boost_static_assert_typedef_63; --------------------------------------------------------^ cxx: Error: z_pp.cpp, line 20987: constant value is not known typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !is_specialized_decimal || precision <= precision_maxarg + 0UL ) >)> boost_static_assert_typedef_74; ----------------------------------------------------------------------------------------------------^ cxx: Error: z_pp.cpp, line 20987: constant value is not known typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !is_specialized_decimal || precision <= precision_maxarg + 0UL ) >)> boost_static_assert_typedef_74; ------------------------------------------------------------------------------------------------------------------------------^ cxx: Error: z_pp.cpp, line 20987: incomplete type is not allowed typedef ::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( !is_specialized_decimal || precision <= precision_maxarg + 0UL ) >)> boost_static_assert_typedef_74; --------------------------------------------------------^ cxx: Info: 5 errors detected in the compilation of "z_pp.cpp".

Ralf W. Grosse-Kunstleve wrote:
Alexander Nasonov wrote:
Does it mean that your std library doesn't define compile-time contants in std::numeric_limits<T> ?
It does define std::numeric_limits<T>. Something more subtle must be wrong. How it compiles this?
#include <ios> #include <limits> #include <boost/config.hpp> #include <boost/integer_traits.hpp> #include <boost/static_assert.hpp> template<class T> struct lcast_precision { typedef std::numeric_limits<T> limits; BOOST_STATIC_CONSTANT(bool, use_default_precision = !limits::is_specialized || limits::is_exact ); BOOST_STATIC_CONSTANT(bool, is_specialized_bin = !use_default_precision && limits::radix == 2 && limits::digits > 0 ); BOOST_STATIC_CONSTANT(bool, is_specialized_dec = !use_default_precision && limits::radix == 10 && limits::digits10 > 0 ); BOOST_STATIC_CONSTANT(std::streamsize, streamsize_max = boost::integer_traits<std::streamsize>::const_max ); BOOST_STATIC_CONSTANT(unsigned int, precision_dec = limits::digits10 + 1U); BOOST_STATIC_ASSERT(!is_specialized_dec || precision_dec <= streamsize_max + 0UL ); BOOST_STATIC_CONSTANT(unsigned long, precision_bin = 2UL + limits::digits * 30103UL / 100000UL ); BOOST_STATIC_ASSERT(!is_specialized_bin || limits::digits + 0UL < ULONG_MAX / 30103UL && precision_bin > limits::digits10 + 0UL && precision_bin <= streamsize_max + 0UL ); BOOST_STATIC_CONSTANT(std::streamsize, value = is_specialized_bin ? precision_bin : is_specialized_dec ? precision_dec : 6 ); }; #include <iostream> int main() { std::cout << lcast_precision<float>::value << '\n'; std::cout << lcast_precision<double>::value << '\n'; //std::cout << lcast_precision<long double>::value << '\n'; } -- Alexander Nasonov Project Manager at Akmosoft ( http://www.akmosoft.com ) Blog: http://nasonov.blogspot.com Email: $(FirstName) dot $(LastName) at gmail dot com
participants (2)
-
Alexander Nasonov
-
Ralf W. Grosse-Kunstleve