Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Treatment of corrupt archives - assert vs. exception throw
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2014-11-12 18:14:24


On Wed, Nov 12, 2014 at 2:09 PM, Robert Ramey <ramey_at_[hidden]> wrote:

> Speaking from memory, I often use BOTH assert and exception. Sometimes
> something looks like a program error which should never happen so I use an
> assert. But should this occur during release mode, it should throw an
> exception.
>

Asserts should be used to report logic errors. In this case the error is
triggered by incorrect format of the data file -- which is not a logic
error, so the correct behavior is to throw and to not assert.

-- 
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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