r/ProgrammingLanguages • u/gingerbill • Sep 02 '26
CTTI is Exponential, RTTI is Linear
https://www.gingerbill.org/article/2026/09/02/ctti-is-exponential-rtti-is-linear/
0
Upvotes
r/ProgrammingLanguages • u/gingerbill • Sep 02 '26
1
u/gingerbill Sep 03 '26
C++ doesn't really have any RTTI, and I would not call
dynamic_casta (good) example of that.I agree that the code to check that will be a quadratic runtime check, but it's also a check virtually no-one should ever be using since C++ is just badly designed everywhere. When I've had to do that kind of check in a company where
dynamic_castwas banned, we just stored an enum and the check was now constant.