POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code : Re: Object Oriented POV code Server Time
29 Jul 2024 04:33:07 EDT (-0400)
  Re: Object Oriented POV code  
From: Christopher James Huff
Date: 25 Feb 2004 08:44:25
Message: <cjameshuff-DF3DAB.08451225022004@news.povray.org>
In article <403b27c6@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

> > Of course, that assumes the compiler's too stupid to turn this into a 
> > direct call in the case that there's no actual dynamic dispatch in the 
> > program. Same kind of thing. Lazy compiler writers. ;-)
> 
>   If a member function has been declared virtual in C++, there's no way
> the compiler can know at compile time there will be no more than one
> derived class implementing that function.

However, there are cases where the compiler can figure out which 
inherited implementation is desired and turn a member function call into 
a static call, or even inline it. Pretty much whenever the exact type of 
the object being referred to is known.


> It can't even theoretically
> check this at linking time because some code in a dynamic library (which
> may change in the future) may implement that virtual function.

C++ doesn't play particularly well with dynamic linking. C++ RTTI and 
virtual functions can cause many problems with it.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

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