by Glowbox · 13y ago · 0 comments
E.g. the example with file open + close in the presentation is laughable. Every C++ programmer knows that this is something that should be done with RAII. I.e. instead of manual close calls you let the destructor handle it. This is both exception-safe and spares you remembering to add a close call on every possible exit-path.
Also one should point out that C++11 has unique_ptr and shared_ptr which in many cases remove the need for the programmer to manage things by himself.
Unless closing the handle causes an exception to be thrown. Either you never see the exception or your program aborts, and neither one is particularly good if you want to write reliable code.
... and the remaining people realise that use of exceptions in C++,
1. almost always creates a trade-off in performance for strong-exception safety guarantees
2. requires special and strong control of side effects throughout the code base, even when there is minimal benefit
3. increases compile times and resource pressure
4. encourages less knowledgeable developers to inappropriately throw exceptions or make poor attempts to recover from them
5. contain some of the least portable platform semantics and handling.
C++ exceptions contain far greater costs and consequences than many programmers realise. For anything other than testing frameworks, it is debatable that they are worth any benefit at all compared to the alternatives.