Re:LLVM Programmer’s Manual
by adamnemecek on Friday July 22, 2016 @01:17AM
(#12141845)
You are correct but all those books on cpp exceptions are about a bit more than dealing with issues related to optionally disabling them :-).
Agree, but that is because when compared with other languages exceptions in C++ were always bolted on.
They don't play well with manual memory management or the C semantics C++ was trying to be as compatible as possible.
They don't play well with:
- constructors/destructors
- manual resource management
- low level code like UNIX signals
- allowing every possible type to be used as exception
So all of that made C++ exceptions poor cousins of how exceptions are used in other languages.
I have used exceptions in quite a few languages and rather use them (the alternative being sum types), but do understand that how C++ evolved they are an unwelcome feature.
It's only exceptions that allow constructors to work properly and that allow the language to support value type management. Without exceptions, you need two-phase initialization, and that's a nightmare.
The bad idea was making language features optional.
Library writers are forced to either support all possible combinations, don't use any of them or use them and see their library being rejected by those that won't turn on the features even at point gun.
One of the things that made me initially enjoy Java was that there weren't features to turn on or off.