Re:Current hardware trends make C++ exceptions harder to jus...
by atq2119 on Wednesday February 23, 2022 @01:19AM
(#30438264)
If your service is public facing and therefore subject to DoS attacks, you should design around the error path being fast.
Which really should be possible with exceptions. It's a shame that it isn't.
Which the paper covers, that's the std::expected section: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p254...
As a bonus not only is using exceptions for this faster, it's also less error prone. There's much less risk of any intermediate function or helper abstraction failing to propagate an error code properly.
Well, it would be if exceptions weren't avoided like the plague in C++ because they have a, well, bad implementation, which can't be meaningfully fixed without ABI breakges (as the paper covers)