4 ms·
The fallible allocators require to use exceptions. There is no way to use, for example, C++ containers with fallible allocators and disabled exceptions. But ev
by fpoling 6y ago
The fallible allocators require to use exceptions. There is no way to use, for example, C++ containers with fallible allocators and disabled exceptions.
But even with exceptions enabled fallible allocation in practice does not work. There was an article that made malloc to return null randomly. All tested C++ implementations crashed then because they allocated memory when generating exceptions.
- pjmlp 6y agoStop talking in circles and point out ISO C++20 sections then. I am also curious to see how serious was that article.
- fpoling 6y agohttp://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0709r3.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p070... - this discusses a lot of issues with exceptions as in ISO C++ and concrete proposals to make exceptions cost-free. The section 4.3.5 discusses specifically memory allocations.
- pjmlp 6y agoIncluding parts that relate to Linux, have nothing to do with C++ and apply to any programming language. You also skipped the section where Rust in its present state doesn't has any kind of recovery, it just panics.