C++ Logo


Advanced search

Subject: Re: [std-proposals] Re-purposing the function exception specification
From: Arthur O'Dwyer (arthur.j.odwyer_at_[hidden])
Date: 2020-06-30 12:33:20

On Tue, Jun 30, 2020 at 1:15 PM andrei--- via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Good afternoon,
> Thanks for the VERY useful insight into the programming-by-contract work.
> I don't see why the "group #1" wants to continue after a contract
> violation - it's like trying to call "double sqrt(double x) require: x >= 0
> { ... }" as "sqrt(-1)" - the obvious choice would be to throw something
> like "bad_contract" on a violation (which should then never be "checked").
> I'll read up on this subject further, so thanks again.
FYI, "throw an exception of type bad_contract, which can be caught higher
up" is the very definition of "continue running the program after a
contract violation."
If you want to *stop* running after a contract violation, then you have to
actually halt the program; you can't say "let's just jump over here and
keep going."


STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups