I remember coding on platforms that had both RTTI and exceptions disabled, and on others that had them both enabled. However, I cannot remember coding on a platform that would enable one and disable the other one.
Is there any kind of dependency between the two concepts? Said differently, do exceptions need RTTI to function? Or the contrary?
No, Exceptions do not need RTTI functionality neither vice versa both are separate features.
Some of the implementations might allow you to disable exceptions(-fnoexceptions in gcc) but I don't know of any implementation which needs RTTI for exceptions or vice versa.
I was just reading this C++ proposal "Zero-overhead deterministic exceptions: Throwing values" (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0709r0.pdf?), in which I read:
"C++ allows there to be multiple active exception objects of arbitrary types, which must have unique addresses and cannot be folded; and it requires using RTTI to match handlers at run time, which has statically unpredictable cost on all major implementations and can depend on what else is linked into the whole program."
and elsewhere it is stated that:
"4) Today’s dynamic exceptions require using some form of RTTI to match handlers."
Thus, it appears there is a relation between exceptions and RTTI
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With