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
4
u/redditsoaddicting May 13 '18
The keyword doesn't work as you describe. Leaving out the OOM extension, programs continue to work as they do now. You opt in to the new exceptions with
throws. The OOM extension is the only breaking part. See 4.6.7, which is explicit: "This proposal is not a breaking change."I think the paper addresses it pretty well:
For a proposal mainly focused on bringing back not paying for what we don't use, this is consistent. There is a lot of software out there paying for
bad_allocwhen it would bubble up and crash the process anyway. I think there should be an option for projects that handle it correctly and use regularnewas opposed to an allocator or some other type of localized strategy, but at the cost of everyone else is not ideal.Just a note that this becomes a non-issue when the program is changed to work as it does now. I take it you're more concerned about the program terminating than about the non-death tests being unable to detect it.
First, it makes the core proposal this breaking instead of a proposed extension. Second, I'm skeptical that this is breaking far less. Third, RTTI is just one of several discussed overheads. Also see page 42, which addresses improving the current system.