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 :-).
[ Parent
| on HN ]
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.