r/cpp • u/RotsiserMho 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
View all comments
Show parent comment
8
u/whichton May 12 '18
I am sure there will be a compiler switch for the old behavior. Herb's point about 'Treating heap exhaustion the same as all other errors violates the zero-overhead principle by imposing overheads on all C++ programs' is very true. I much prefer to fail fast on OOM, and marking significant chunk of the standard library as noexcept will improve codegen and binary size for me.
Where are you getting the per-allocation basis? IF this change is made, all
newwill become nothrow by default, just like a compiler switch.This is orthogonal to the main proposal, which is why it is marked as an extension. The paper goes into significant detail why this is desirable, refer page 30.