|
|
|
|
|
by trws
940 days ago
|
|
It depends a great deal on your situation. Where I work, we have codes up to 3 million lines, they all have exceptions and rtti turned on. You’ll find similar situations all over except at google and in gaming, and to some extent anywhere that last quartile latency is a serious concern. The thing about exceptions is that when you throw none of them they cost almost nothing, but throwing one costs on average about 1000 times as much as returning a value would. It’s a massive hit, especially if you care about latency, so it’s best to avoid them for control flow or anything but truly exceptional situations. RTTI I’d say it’s best to only use in testing and debugging generally, it just plain isn’t reliable for the uses people seem to try to put it to. |
|
I think another big issue is the complexity overhead of 'introducing' exceptions in a already complicated language. When you use exceptions the control flow of the program gets 'invisible' should you recover from a exception.
Also, just writing data structures in general that obeys the weak and/or strong exception guarantee is not very easy [1].
Like it makes writing (correct) C++ even harder than it already is.
[1]: https://en.cppreference.com/w/cpp/language/exceptions