Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization: C4308 warning with MSVC9
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-05-18 22:35:29


Political Confusion wrote:
> Political Confusion <politicalconfusion <at> yahoo.com> writes:
>
>>
>> I'm using Boost 1.43 with MSVC9 SP1 and Windows SDK v7 on Windows 7.
>> I've
> created a class like the "A Very
>> Simple Case" example (i.e. added 'access' as friend and a templated
>> serialize function). In serialize, I just archive 10 ints (signed
>> and unsigned). It compiles fine, but when I add
> program code to save my class to
>> a text_oarchive, I get a warning:
>>
>> c:\third-party\boost_1_43_0\boost\mpl\print.hpp(51) : warning C4308:
>> negative integral constant converted to unsigned type
>>
>> Line 51 of print.hpp is: enum { n = sizeof(T) + -1 };
>>
>> Calling sizeof() on my class gives a 44. I do not get any warning
>> when I load
> my class with text_iarchive. And
>> both save and load appear to work fine.
>>
>
> I had to add the following to make this warning go away:
>
> BOOST_CLASS_TRACKING( my_class, boost::serialization::track_never )

This warning should precede a long call chain. If you go to the the
call BEFORE this, you should find a comment which indicates why this
warning is invoked.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net