3 ms·
I think a lot of people HAVE made the case convincingly, at least well enough for me. I have worked in major C++ shops that ban the use of exceptions (and enfo
by MetaCosm 13y ago
I think a lot of people HAVE made the case convincingly, at least well enough for me. I have worked in major C++ shops that ban the use of exceptions (and enforce it).
Just to add another person who regrets exceptions to the big pile, http://250bpm.com/blog:4 http://250bpm.com/blog:4 (The ZMQ Author)
"Thus, the error handling was of utmost importance. It had to be very explicit and unforgiving.
C++ exceptions just didn't fill the bill. They are great for guaranteeing that program doesn't fail — just wrap the main function in try/catch block and you can handle all the errors in a single place.
However, what's great for avoiding straightforward failures becomes a nightmare when your goal is to guarantee that no undefined behaviour happens. The decoupling between raising of the exception and handling it, that makes avoiding failures so easy in C++, makes it virtually impossible to guarantee that the program never runs info undefined behaviour.
With C, the raising of the error and handling it are tightly couped and reside at the same place in the source code. This makes it easy to understand what happens if error happens..."
- pjmlp 13y agoThat is a problem with the way exceptions work in C++, not with the exceptions as concept. C++ exception's design suffer from being added to the language in the last years of the language's design and having to support the possibility of being turned off if desired. This, coupled with the manual resource management of the language is with lead to some of the issues with exceptions in C++. Not all languages with exception's support suffer from the same problems.