[OT] - C++ exceptions are becoming more and more problematic

deadalnix deadalnix at gmail.com
Thu Feb 24 13:19:55 UTC 2022


On Thursday, 24 February 2022 at 12:33:04 UTC, Mike Parker wrote:
> On Thursday, 24 February 2022 at 08:05:42 UTC, forkit wrote:
>
>>
>> That is, how do I reconcile your above statement with your 
>> previous statement:
>>
>> "Why exceptions for error handling is so important" - Walter 
>> Bright.
>>
>
> The fact that D has had exceptions from the beginning shows he 
> thought they were a good idea before. Opinions evolve over time.

I don't see what from the discussion here and from the original 
document demonstrate exception to be a bad idea.

In fact, in the benchmark they propose, all alternative solution 
are slower in the fast path. The tradeof that is proposed by 
exceptions is the following: have as little impact as possible on 
the fast path, at the cost of making the exceptional path 
significantly slower.

This is a worthy tradeof.

And when I'm saying getting out of the way, I'm not talking 
exclusively run time, but also for the developer: there is no 
need to litter the code with numerous exception handling path all 
over the place.

I'm not sure I understand why C++ exception need to take a lock. 
What have they done this time to deserve this?


More information about the Digitalmars-d mailing list