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.
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.
Don’t get me wrong, maintaining exception guarantees and ensuring exceptions are appropriately caught is terrible. I much prefer working with optional and outcome and similar personally, but the assumption of exceptions is very deeply baked in, and avoiding them safely is a lot harder than one might guess.
Also, remember that while exceptions cost code size, they cost literally nothing in instructions executed unless an exception is actually thrown. That’s why the common nix implementation is called “zero cost exceptions”. In the happy path case they are faster than returning a discriminant. It’s not having exceptions available that makes code slow, it’s using them for things that are expected rather than unexpected or for control flow.
[1]: https://twitter.com/TimSweeneyEpic/status/122307740466037145...