
On Mon, Sep 3, 2012 at 12:54 AM, Sebastian Redl <sebastian.redl@getdesigned.at> wrote:
On 02.09.2012 21:40, Andrzej Krzemienski wrote:
2012/9/2 Dave Abrahams <dave@boostpro.com>
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