> Virtual functions most probably can't be inlined (although this is one
> detail where I'm not 100% sure).
I some circumstances, they can. For instance when you know the type.
Consider the static
class_with_virtual_member object;
object.virtual_member();
as opposed to the dynamic
base_class_with_virtual_member *object = new derived_class_with_virtual_member;
object->virtual_member();
I think it might be possible for a smart compiler to optimize even
more complex situations (by tracing through functions, perhaps? I
don't know that much about compilers).
--
Ole Laursen
http://sunsite.dk/olau/
Post a reply to this message
|