[Boost-bugs] [Boost C++ Libraries] #3118: [Serialization] basic_binary_oarchive.hpp - save_override possible loss of data warnings

Subject: [Boost-bugs] [Boost C++ Libraries] #3118: [Serialization] basic_binary_oarchive.hpp - save_override possible loss of data warnings
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-06-01 12:41:03


#3118: [Serialization] basic_binary_oarchive.hpp - save_override possible loss of
data warnings
------------------------------------+---------------------------------------
 Reporter: jflinn_at_[hidden] | Owner: ramey
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: serialization
  Version: Boost 1.39.0 | Severity: Problem
 Keywords: Serialization, warning |
------------------------------------+---------------------------------------
 The following save_override overloads cause possible loss of data warnings
 on MSVC8 and XCode3.1.2/gcc4.0.1

   void save_override(const version_type & t, int)
   void save_override(const class_id_type & t, int)
   void save_override(const class_id_reference_type & t, int)

 with their respective assignments:

   const unsigned char x = t.t;
   const int_least16_t x = t.t;

 While a possible fix would be:

   const unsigned char x = static_cast<unsigned char>(t.t);
   const int_least16_t x = static_cast<int_least16_t>(t.t);

 there is still a possibility of a silent loss of data.

 We could be safer and use numeric_cast, but that would possibly impact
 code size and performance.

 Why are the xxx_type strong typedef's using int rather than the smaller
 types that are being serialized?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3118>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC