Boost logo

Boost :

From: Drew Hohmann (drew_at_[hidden])
Date: 2007-09-24 08:25:47


I've found a few minor issues with the Boost::Serialization in VS2005.

-C++ Exceptions are set to Yes (/EHsc) and the boost library isn't
automatically detecting this. I had to manually declare _CPPUNWIND in
the preprocessor.

-I needed to add #pragma warning(disable:4267) to
collections_save_imp.hpp to get rid of warnings due to unsigned int
count = s.size(); (containers use size_t as their size, not an unsigned
int. Could be trouble in 64-bit world with really large containers).

-I had to #define _SCL_SECURE_NO_WARNINGS 1 , as otherwise I get
warning C4996 from compat_traits_type::copy(newptr, oldptr,
prev_size); in alt_sstream_impl.hpp

-The tutorial says to use ar &
|boost::serialization::base_object<bus_stop>(*this); to save the base
class. This doesn't work when saving XML, as the
|BOOST_SERIALIZATION_NVP macro blows up because : is not a valid file
character. I ended up doing
|bus_stop |&bsbase = dynamic_cast<bus_stop_corner&> (*this);
ar & bsbase
to save the base class.
I'm not sure if BOOST_SERIALIZATION_NVP also has issues with a
dereferenced pointer, as I didn't try but I suspect it may
(BOOST_SERIALIZATION_NVP(*this)) for example.

-In MFC serialization it is common to do the following
bus_stop bs;
archive << &bs;

bus_stop *pbs = NULL;
archive >> pbs

the MFC CArchive automatically allocates the memory when archiving back
a pointer. Using boost, I was getting no warnings, no errors, and it
was a very difficult bug to track down because the only error I would
get would be an exit code 3 from one of my threads. The tutorial should
document this, and ideally boost::serialization should either give a
warning or an error if the user tries to do this.

Thanks, let me know if you need any more info or have any questions.
Drew Hohmann
Software Engineer
drew_at_[hidden]


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