Boost logo

Boost :

Subject: Re: [boost] [outcome] success-or-failure objects
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2018-01-23 22:13:22


On Tue, Jan 23, 2018 at 1:25 PM, Niall Douglas via Boost <
boost_at_[hidden]> wrote:

> > I have a question, who throws exceptions to indicate logic errors?
>
> There's a sizeable number of people who are very keen on doing so. Hence
> std::logic_error and family i.e. WG21 historically has agreed.
>

It is unreasonable to think that a program that has just encountered a
logic error can recover gracefully from it any more it can do so from a
crash. Try to recover, and you might make things worse, possibly much worse.

> I'd now go so far as to assert - not even claim - that if you're
> throwing logic-error-type-exceptions in brand new C++ 14 or 17 library
> code, you're doing something very wrong.

Yes indeed.

Emil


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