-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
Description
RTTI (Runtime Type Idenfitication) used with dynamic_cast<> allows casting do a type or to nullptr if the type doesn't match. It is a very useful feature. But it's also a costly feature at runtime. It's also potentially introduces nullptr in places where it shouldn't be. So it should be avoided whenever possible. In some environment it's even turned off.
mkvtoolnix uses it a lot and even mkvtree needs it to differentiate between base EBML types to display. It can be partly avoided by adding the EBML type inside the EbmlCallbacks (aka element spec). All EBML elements have a type defined in the EBML RFC. It can be used as an enum to initialize each EbmlCallbacks.