[LLVMdev] dyn_cast vs. dynamic_cast

Óscar Fuentes ofv at wanadoo.es
Mon Nov 15 13:59:01 PST 2010


Trevor Harmon <trevor.w.harmon at nasa.gov> writes:

>>> Could someone
>>> please explain why I should use dyn_cast instead of dynamic_cast? (I
>>> thought all classes have v-tables...) Thanks,
>>
>> For reducing executable size, LLVM builds with RTTI disabled where
>> possible.
>
> Right, but how does that relate to dyn_cast? I thought v-tables were
> present even when RTTI is not (because otherwise polymorphism would be
> impossible).

v-tables are used for dispatching method calls. If you want to know if
something points to certain class (or to a derived class of certain
class) you need RTTI.

This is off-topic here. Googling for RTTI will resolve any remaining
doubts.



More information about the llvm-dev mailing list