Boost logo

Boost :

Subject: Re: [boost] [serialization] Warnings with MSVC 7.1
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-11-14 01:56:38


This case is descibed in the rationale section of the documentation.

Disregard/disable at your own risk. I don't recommend it. I recommend
changing your code to avoid situation which avoids warnings.

Robert Ramey

Chard wrote:
> I've been working on a cut-over of a code-base from Boost 1.34.1 to
> 1.37 and have found I now get a lot of compiler warnings in the
> serialization code.
>
> The warnings (emitted via BOOST_STATIC_WARNING) appear to be where
> non-polymorphic objects are serialized via shared_ptr. The boost
> serialization code seems to want them to be polymorphic.
>
> Are these benign warnings that can be disabled?
>
> Apologies if this has been raised earlier; I had a good look..
>
> The following example code triggers the warnings (MSVC 7.1):
>
> ======
>
> #include <boost/archive/text_oarchive.hpp>
> #include <boost/archive/text_iarchive.hpp>
> #include <boost/serialization/serialization.hpp>
> #include <boost/serialization/shared_ptr.hpp>
>
> using namespace boost;
>
> struct X
> {
> template <typename T>
> void serialize(T &ar, const unsigned int version)
> {}
> };
> typedef boost::shared_ptr<X> X_P;
>
> void
> test_ser()
> {
> X_P x_p;
>
> std::ifstream ifstr("test.txt");
> boost::archive::text_iarchive ar(ifstr);
> ar & x_p;
> }
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk