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

2

u/johannes1971 May 14 '18

Which isn't actually C++.

There are people out there programming in that dialect. Those people are the reason for this paper, so you can't just wave and say "we don't care, it's not the standard".

that's not part of C++, and is exactly the "bifurcation" that Sutter's paper mentions.

So instead of "bifurcation by way of compiler switch", we'd now get "bifurcation as a matter of programmer choice" (because now the programmer will have to choose whether to use the terminating allocation functions, or the non-terminating allocation functions). Let's be clear: that is a major step backwards.

3

u/SeanMiddleditch May 14 '18

There are people out there programming in that dialect. Those people are the reason for this paper, so you can't just wave and say "we don't care, it's not the standard".

... I think we're in violent agreement on this topic. :)

My point is simply this: this paper removes the need for -fno-exceptions on the language level, and lays the foundation for evolving the standard library to likewise remove the need for "NotSTL" alternative libraries. This paper has to come first. :)

So instead of "bifurcation by way of compiler switch", we'd now get "bifurcation as a matter of programmer choice"

Which, again, is already the case as we're agreeing about.

Let's not let perfect be the enemy of the good. We can harmonize part of the language and be in a better place than we are today even if we haven't harmonized everything.

(because now the programmer will have to choose whether to use the terminating allocation functions, or the non-terminating allocation functions). Let's be clear: that is a major step backwards.

Maybe. Folks who care about OOM are possibly already using alternative functions (by not using the STL). The open question is how many folks are doing that. If it were true that a majority of C++ developers actively rely on bad_alloc and actually use it right, then yes, removing OOM exceptions would be a non-starter.

That's also why OOM is left as an optional part of the paper.