Description
- it is very hard or impossible to implement exceptions on many platforms. Half of my cross toolchains simply do not have working implementations due to implementation difficulties.
web assembly. operating system kernel.
I recently dealt with wasm2lua, it would compile C++ code to Lua. There is no way to implement exception handling in lua.
-
Runtime bloat. The EH runtime would bloat at least 50kb with libgcc_eh + 100kb if you use things like std::string (since they throw std::logic_error). It is very a large runtime that is not worth it at all.
-
Every function could throw if it is not marked as noexcept, particular C functions.
-
Still a lot of implementations are using setjmp longjmp, including 32 bit windows and emscripten (well the exceptions in emscripten is using js exceptions to emulate setjmp/longjmp)
-
Talking about the performance of "happy path" is totally nonsense because a lot of so-called "bad-path" could simply be dealt with a std::abort to crash the program, instead of throwing exceptions and that provides much better performance than EH.
I do not think even breaking abi would solve the fundamental issue being C++ EH is terribly designed in the first place. The implementation difficulty of C++ EH is not going to be solved by breaking ABIs. Bjarne is wrong at this.
https://www.youtube.com/watch?v=I_ffAFzi-7M
P0709 is the only solution EXCEPT I hope std::error is not going to screw up due to heap allocation with stringref thing.
Same with iostream. Things like std::format are actually making things much worse instead of better.
In general, WG21 has a very bad priority and a lot of incompetent committee members. C++ freestanding does not even provide std::addressof, std::move, std::forward (no std::array of course), even std::addressof relies on compiler magic. Also, LLVM libc++ refuses to provide the freestanding implementation. Despite Bjarne and other standard C++ people believing C++ is very good at writing operating system, they are totally wrong about this. C++ is terrible for kernel development.
https://www.youtube.com/watch?v=DorYSHu4Sjk
https://www.youtube.com/watch?v=B1KB1U3HPKo