Boost logo

Boost :

Subject: [boost] [Serialization] can BOOST_ASSERT have method calls?
From: Patrick Horgan (phorgan1_at_[hidden])
Date: 2011-01-18 04:58:01


I noticed in serializations basic_iarchive that when you're not building
for debug the next line here (317 in basic_iarchive.cpp) has a warning
for unused variable new_cid. The BOOST_ASSERT is instantiated as
((void)0) so new_cid really isn't used. Could the register_type call be
moved into the assert?

        class_id_type new_cid =
register_type(bpis_ptr->get_basic_serializer());
         int i = cid;
         cobject_id_vector[i].bpis_ptr = bpis_ptr;
         BOOST_ASSERT(new_cid == cid);

Something like:

         BOOST_ASSERT(register_type(bpis_ptr->get_basic_serializer()) ==
cid);

Then the new_cid variable wouldn't be needed and the call to
register_type would disappear with the BOOST_ASSERT if you aren't
building for debug. Or, does the call to register_type have an
important side effect that is required?

Patrick


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