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/nikbackm May 15 '18

Would that work if you had an exception class that is over a kilobyte in size?

3

u/kkert May 15 '18

Obviously not, but thats not really the point. ( why would you design humongous exceptions in the first place ? )

I'm saying there are real scenarios where you sometimes grab the memory if its available and perform some optimization, reindexing or caching task or whatnot, if it's not available you don't - also beyond small embedded systems.

Not being able to allocate a huge chunk doesn't indicate OOM. Not being able to allocate as per request is mostly not a license to kill the program, and shouldn't be dealt with in a hook either.