News for hackers. Stuff that matters.
Re:The Year of C++ Successor Languages by alphanullmeric on Monday January 02, 2023 @07:07AM (#34217059)
Exceptions have zero cost when not thrown, apart from being included in the binary
Re:The Year of C++ Successor Languages by pornel on Monday January 02, 2023 @10:13AM (#34218718)
A mere possibility of a function throwing an exception is a side effect that an optimiser can't ignore, and this inhibits many types of optimisations involving code motion. This is for example the main cost of bound checking in Rust, not the branches.
Re:The Year of C++ Successor Languages by AshamedCaptain on Monday January 02, 2023 @01:50PM (#34221956)
I always hear this, but these days entire Linux distros build with -fasynchronous-unwind-tables which has much more overhead than C++ exceptions, since now you have to provide an unwind path for every single instruction boundary. Even Chrome does it (for "accurate stack traces") when otherwise they're on the no exceptions camp. Using this option also completely subsumes the otherwise negligible cost of C++ exceptions, which only affects non-inlined function calls (which already limit code motion anyway).