Boost logo

Boost Users :

Subject: Re: [Boost-users] serialisation use of asserts versus throw ?
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-09-06 13:26:38


Avi Bahra wrote:
> 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.

archive versioning is designed to address this concern.

> 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.

Assert is used when a condition occurs which seems
to indicate that no reliable recovery is possible. This
is preferred over some feeble attempt at recovery
which only will hide the error.

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

Boost serialization archive versioning.

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

nope.

Having said all this, sometimes one makes an error and assigns
an Assert to a situation which is actually a reoverable runtime
error. Those are bugs for which a trac item may be submitted.
I don't think this is the case for your situation.

Robert Ramey


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