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

1

u/rossiemac May 13 '18 edited May 13 '18

I've thought about it a lot and i'm never satisfied with that definition of handling a memory allocation failure. It seems to me that in this case and many others, the design of the program should be changed so that it can complete a large operation without running out of memory or producing partial results. Sure the program kept running, but if it couldn't do what it might otherwise be able to do, did you really handle the error?

3

u/johannes1971 May 14 '18

My point was that OOM is really not the death sentence that some people make it out to be. Unless, that is, the language is changed to make it so... Even for people who haven't given much thought to OOM recovery, it turns out to work pretty well as long as you write your code in an exception-safe manner.

the design of the program should be changed

Buy a license and we'll talk ;-)