Related articles |
---|
[2 earlier articles] |
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: 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) |
Re: C++ virtual function calls jplevyak@violet-femmes.cs.uiuc.edu (John B. Plevyak) (1995-11-09) |
Re: C++ virtual function calls cliffc@ami.sps.mot.com (1995-11-05) |
Re: C++ virtual function calls martelli@cadlab.it (1995-11-05) |
Re: C++ virtual function calls bothner@cygnus.com (Per Bothner) (1995-11-06) |
C++ virtual function calls fjh@cs.mu.OZ.AU (1995-11-12) |
Re: C++ virtual function calls jplevyak@pink-panther.cs.uiuc.edu (1995-11-16) |
Newsgroups: | comp.compilers |
From: | martelli@cadlab.it (Alex Martelli) |
Keywords: | C++, optimize, comment |
Organization: | Cad.Lab Spa, Bologna, Italia |
References: | 95-10-029 95-11-020 |
Date: | Sun, 5 Nov 1995 19:44:33 GMT |
joe@sanskrit.ho.att.com (Joe Orost) writes:
>I don't think it is legal to hoist the virtual function lookup
>out of the loop:
>for( ...) {
> p->virt_func();
>}
>because "p" is passed to virt_func as "this", and therefore the
>function could change the subtype of "p", causing a different
>function to be called next time around the loop!
Hmmmm... you mean by doing something like "~typeofp(); new(p) typeofp(22);"?
I'm not sure this would be legal -- an interesting question for
comp.std.c++, if the comp.compiler moderator would pretty please
crosspost this to there (crossposting on two mod groups at once
can really be -- ahem -- "interesting"!-).
Alex
--
DISCLAIMER: these are TOTALLY personal opinions and viewpoints, NOT connected
in any way with my employer, nor any other organization or individual!
Email: martelli@cadlab.it Phone: +39 (51) 597313
CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia Fax: +39 (51) 597120
[No need to crosspost, it's not allowed. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.