Boost logo

Boost Users :

Subject: Re: [Boost-users] serialisation use of asserts versus throw ?
From: Nat Linden (nat_at_[hidden])
Date: 2012-09-06 07:50:09


On Thu, Sep 6, 2012 at 6:19 AM, Avi Bahra <avibahra_at_[hidden]> 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.
>
> 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.

This is an interesting policy point that's broader than the
serialization library. The Boost.Coroutine library is being reviewed
right now, and one reviewer has requested that the library use assert
rather than throw for precondition violations.

Maybe I'm conflating failure conditions that are conceptually
distinct. If so, I apologize. If there is already text on the Boost
website that clarifies when a Boost library should use assert vs.
throw, please point me to it.

If there is not -- perhaps there should be.


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