Boost logo

Boost :

Subject: Re: [boost] [Serialization] can BOOST_ASSERT have method calls?
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2011-01-18 07:42:46

Patrick Horgan wrote:
> 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);

IIRC, register_type would not be called in release builds. MSFT had a
VERIFY macro which asserted in debug, and still executed the statement
in release builds. Or am I mistaken about BOOST_ASSERT's implementation?


Boost list run by bdawes at, gregod at, cpdaniel at, john at