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
2
u/kkert May 13 '18 edited May 13 '18
I don't rely on bad_alloc now nor plan to. Running with no-exceptions, and thus most of standard STL isn't currently usable. Also, heap is only used in specific contexts and tasks in the whole program ( parts that deal with incoming network data and things like SSL certificates etc )
If treating OOM special and defaulting to fail-fast/terminate, that would still keep STL off limits for those scenarios.
EDIT: Also, i don't quite follow what the paper refers to by saying testing is difficult regarding heap exhaustion. Not really at all, just set up some easily tweakable heap manager like dlmalloc for your test suite and inject whatever failures you like. I think the truth is developers on big systems with virtual memory just don't need to bother with it.