Boost logo

Boost Users :

Subject: [Boost-users] serialisation use of asserts versus throw ?
From: Avi Bahra (avibahra_at_[hidden])
Date: 2012-09-06 06:19:06


This is question about use of asserts in boost serialisation.

As a program migrates from one release to another
the api changes. This is expected. In my case I have
client/server that uses boost serialisation.

I was expecting an throw due to the incompatibility
not a an assert. The assert crashes my client,
giving no chance for recovery, and informing the user
that they are using previous out of date release/server.

In may case: boost_iarchive.cpp

inline const basic_pointer_iserializer *
 399 basic_iarchive_impl::load_pointer(
 400 basic_iarchive &ar,
 401 void * & t,
 402 const basic_pointer_iserializer * bpis_ptr,
 403 const basic_pointer_iserializer * (*finder)(
 404 const boost::serialization::extended_type_info & type_
 405 )
 406
 407 ){

     .....

 436 BOOST_ASSERT(NULL != bpis_ptr);
 437 class_id_type new_cid =
register_type(bpis_ptr->get_basic_serializer());
 438 int i = cid;
 439 cobject_id_vector[i].bpis_ptr = bpis_ptr;
 440 BOOST_ASSERT(new_cid == cid); // yikes

How do people get round this issue, where old and new release
of software need to co-exist ?

Would it be possible to use a #define to configure use of
asserts or throw ?

Any help apperciated .

Best regards,
Ta,
    Avi


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