Boost logo

Boost :

Subject: Re: [boost] [Contract] noexcept and custom contract violation handlers
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-09-02 12:21:33

on Thu Aug 30 2012, Andrzej Krzemienski <> wrote:

> Hi,
> I have just realized that there is an interesting interaction between
> "noexcept" and Contract Programming framework. Not only Lorenzo's library,
> but even if contracts were a language feature. N3248 ("noexcept prevents
> library validation",
> recommends that functions with any preconditions should not be declared
> noexcept(true) in case someone wants to report precondition failures via
> exceptions.

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.

Dave Abrahams
BoostPro Computing                  Software Development        Training             Clang/LLVM/EDG Compilers  C++  Boost

Boost list run by bdawes at, gregod at, cpdaniel at, john at