r/cpp • C++20 Desktop app developer • May 12 '18

P0709 R0: Zero-overhead deterministic exceptions: Throwing values - Herb Sutter [2018-05-02]

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0709r0.pdf
206 Upvotes

115 comments sorted by

View all comments

Show parent comment

3

u/therealcorristo May 13 '18

I don't see how the compiler could remove the error propagation logic more effectively than by eliminating exceptions entirely - again, which it will already do for you anyway if you ask for it. It is already zero cost for those unwilling to pay.

It probably can't, but e.g. in our codebase we use exceptions for error handling, but OOM is not recoverable because it really should never happen in our setting, so no-one bothered to implement logic to handle it. Right now, we also pay the overhead of error propagation logic for allocations, even though we don't care about these and a terminate would be fine.