POV-Ray : Newsgroups : povray.programming : C++ problem : Re: C++ problem Server Time
28 Jul 2024 20:27:34 EDT (-0400)
  Re: C++ problem  
From: Ole Laursen
Date: 30 Jul 2001 14:27:28
Message: <m3y9p61dli.fsf@bach.composers>
> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.