Daniel Krügler wrote:
The streaming inserter of Boost archive's dinkumware.hpp for boost::int64_t causes indefinite recursion in case of negative arguments. I think the following line inside the else clause should be changed from
os << -t;
to
os << static_castboost::uint64_t(-t);
Greetings from Bremen,
Daniel
I apologize for incomplete information. The streaming inserter does not cause infinite recursion in **general** cases, but only in one special case: If the argument equals std::numeric_limitsboost::uint64_t::min(). This is a special case, because in 2-complement systems (I think, that is the only audience for that header) negating this value will return a negative number. From a general standpoint of C++ this is one special form of U.B., as described in section 6.2.5 of the C99 standard (I have no older C standard available), but considering the code to be available only for the platform target I **assume** (contradictory opinions anywhere?) that the proposed code, which in general C++ would also cause U.B., uses platform specific behaviour to prevent that case. Greetinmgs from Bremen, Daniel Krügler