Subject: Re: [boost] [serialization] basic_binary_oarchive.hpp asserts are nolonger necessary
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-02-03 11:46:13
Number Cruncher wrote:
>> I've just tried building my code against 1.42 and am encountering
>> numerous warnings of the sort:
>> boost/archive/basic_binary_oarchive.hpp:95: warning: comparison is
>> always true due to limited range of data type
>> I've checked the difference to the 1.41 release and noticed that
>> boost/archive/basic_archive.hpp now uses BOOST_ARCHIVE_STRONG_TYPEDEF
>> for class_id_type etc. and uses int_least16_t rather than "int".
>> This is causing my GCC 4.1.2 compiler to produce the above warning
>> because the assertion "t.t <=
>> boost::integer_traits<boost::int_least16_t>::const_max" is always
>> when t.t *is* an int_least16_t
>> The attached patch removes the (now redundant) asserts.
I don't see the asserts as redundant. Suppose that one actually
uses 32K classes in his program. The program would fail.
Of course this is unlikely, but someone could change the type
of version type, or int_least16_t could be implemented
wrong on some platform or who knows what. If the
only issue is the warnings, then a cast inside the assertion
would be a better solution. Or maybe using
boost::integer_traits<version_type>::const_max - but
I don't think that would work. Feel free to make a
track item on this.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk