Minor spurious warning message -- Very Trivial

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Minor spurious warning message -- Very Trivial

Robert S. Grimes
Hi all,

Using Boost 1.33.1 serialization library with Micro$oft Visual Studio 2005,
I get two minor warnings while compiling the demo_xml.cpp program.  They are
in boost/serialization/collections_save_imp.hpp.  Lines 36 and 37 in the
function template save_collection are the culprit, resulting in warnings of
the form:

  warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned
int', possible loss of data

These are the problem lines:
  unsigned int count = s.size();
  ar << make_nvp("count", const_cast<const unsigned int &>(count));

Changing the "unsigned int" to "size_t" fixes the warnings, like this:
  size_t count = s.size();
  ar << make_nvp("count", const_cast<const size_t &>(count));

Trivial problem, I admit, but warnings are warnings...

Cheers,
-RSG
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Minor spurious warning message -- Very Trivial

Beman Dawes

"Robert S. Grimes" <[hidden email]> wrote in message
news:[hidden email]...
> Hi all,
>
> Using Boost 1.33.1 serialization library ...

It helps library maintainers zoom in on pasting about their library if you
put the name of the library in the subject line. The usual convention looks
like this:

    [serialization]  Minor spurious warnings -- Very Trivial

Thanks,

--Beman



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users