C++ virtual function calls

tim@franck.Princeton.EDU (Tim Hollebeek)
Fri, 29 Sep 1995 13:02:04 GMT

          From comp.compilers

Related articles
C++ virtual function calls tim@franck.Princeton.EDU (1995-09-29)
Re: C++ virtual function calls cliffc@ami.sps.mot.com (1995-10-05)
Re: C++ virtual function calls dlmoore@ix.netcom.com (1995-10-14)
Re: C++ virtual function calls genew@mindlink.bc.ca (1995-10-23)
Re: Re: C++ virtual function calls egouriou@CS.UCLA.EDU (Eric Gouriou) (1995-10-23)
Re: C++ virtual function calls cliffc@ami.sps.mot.com (1995-10-25)
Re: C++ virtual function calls joe@sanskrit.ho.att.com (1995-10-30)
[6 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: tim@franck.Princeton.EDU (Tim Hollebeek)
Keywords: C++, optimize, question
Organization: Princeton University
Date: Fri, 29 Sep 1995 13:02:04 GMT

I was writing some C++, and in the middle of a tight loop, had
something like:


Base *foo = ...;


for (...) {
        foo->virtual_method(...);
}


Are compilers smart enough to lift the virtual lookup out of the loop?
Is this commonly done? It seems like an easy optimization, but I'm
not sure if I'm missing something, or if compiler writers are still
too busy implementing partially specialized virtual template functions
that throw templated exception classes based on RTTI info.


--
Tim Hollebeek
PChem Grad Student
Princeton Univ.
-------------------| tim@handel.princeton.edu http://wagner.princeton.edu/~tim
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.