Boost logo

Boost :

Subject: Re: [boost] [outcome] success-or-failure objects
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2018-01-23 21:25:17


> 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.

I would agree it's a least worst choice for C++ 98 and 03. Maybe even
C++ 11. But any new code written in the last five years has much better
alternatives available to it.

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. It's a design pattern which
imposes considerable costs on your users, and for very little gain when
there are so many better alternatives available in today's tooling and
support libraries.

Cue now some of said sizeable number of people who think that I am dead
wrong on that assertion ...

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

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