C++ Logo

std-discussion

Advanced search

Re: Are Exceptions deeply flawed?

From: Tony V E <tvaneerd_at_[hidden]>
Date: Thu, 8 Aug 2019 15:06:05 -0400
On Thu, Aug 8, 2019 at 2:43 PM Dmitry via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> I could get on board with the idea that we should discourage people from
>>>> using exception handling in situations where return codes would be a
>>>> *better* solution but you have not established that return codes are *almost
>>>> always better* than exceptions for *almost all programmers*. This is
>>>> quite different from the situation with smart pointers versus manual memory
>>>> management.
>>>>
>>>
> In general, yes, I agree with you, but I do not understand then why
> expected<> is not still in the standard.
>
> Note also that the question of the probability of the "exceptional" events
>>> occurring is not relevant here, except perhaps in a performance-sensitive
>>> context. Whether you want to make that iterator throw an exception on an
>>> I/O error, or return expected<char, E>, regardless of the fraction of the
>>> time that the error path is taken, is a stylistic choice.
>>>
>>
> Yes and no. By saying "*use exceptions for exceptional situations*"
>

Let's just stop saying that.

It sounds catchy, but I think it is inherently wrong. As some of your
arguments point out.

That doesn't necessarily mean exceptions are wrong, it just means that
saying is wrong.

-- 
Be seeing you,
Tony

Received on 2019-08-08 14:08:17