[OT] - C++ exceptions are becoming more and more problematic
Paulo Pinto
pjmlp at progtools.org
Thu Feb 24 08:08:49 UTC 2022
On Wednesday, 23 February 2022 at 18:27:45 UTC, deadalnix wrote:
> On Wednesday, 23 February 2022 at 14:26:41 UTC, matheus wrote:
>> Just saw this today:
>>
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2544r0.html
>>
>> Seems relevant to any System Language like D that features
>> Exceptions.
>>
>> Matheus.
>
> This is an interesting paper, but I'm not sure where they are
> going with it.
>
> Exception are expensive. They need to be used to handle
> unexpected things. That's kind of in the name. Things that
> happen often are not exceptional.
>
> Pretty much all workaround they look at incur some performance
> penalty on the happy path, but this is not a bug, this is a
> feature. Exceptions are very cheap when not thrown, very
> expensive when thrown. This is what you want when handling a
> situation that is exceptional.
>
> The perf they measure for std::expect would be worth
> investigating. Why is it slow?
They aren't going anywhere, most of Herb's latest papers seem
like ideas how the language could be improved upon, but beyond
the original paper, presentation at CppCon and eventually some
prototype available on Compiler Explorer, little more has
happened.
I might be wrong here, but from C++ mailings it is clear nothing
is happening with those papers.
Also in regards to exceptions, Bjarne has a paper where he
criticizes the current compiler implementations for leaving
performance improvements on the table by not wanting to break
existing ABIs, while arguing against Herb's approach.
"C++ exceptions and alternatives"
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1947r0.pdf
More information about the Digitalmars-d
mailing list