Boost logo

Boost :

Subject: Re: [boost] [Contract] noexcept and custom contract violation handlers
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2012-09-03 21:04:56


On Mon, Sep 3, 2012 at 12:54 AM, Sebastian Redl
<sebastian.redl_at_[hidden]> wrote:
> On 02.09.2012 21:40, Andrzej Krzemienski wrote:
>
>> 2012/9/2 Dave Abrahams <dave_at_[hidden]>
>>
>>> This is bad advice and should be ignored. Exceptions and preconditions
>>> have no inherent relationship, exceptions are not a good tool for handling
>>> precondition failures, and nothing should be done to link them.
>>
>> I agree in principle; however, N3248 provides one example that cannot be
>> that quickly dismissed: testing if your library defined (and verified)
>> enough preconditions.
>
> googletest, just as an example, provides death tests. Set Contract to
> terminate on violation (as it should) and run them.

Just to be 100% clear, if you don't set anything, Contract will
terminate on violation--that's default behavior "out of the box", you
have to set stuff to throw, exit, abort, ignore, or do whatever else
you might want to do instead of termination.

Thanks,
--Lorenzo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk