Re: Optimization bug in virtual call



Olivier Lauffenburger <utanapishtim@xxxxxxxxxxxxxxxxx> wrote:
Compiled with Visual Studio 2005 SP1 in Release project
configuration, this calls C::SetPosit(), but the call ResetExport()
in C::SetPosit() does not jump to A::ResetExport() but to C::Rotate()
!

Since the two functions are exactly the same, down to the last byte of
machine code, the linker folded them together and set both vtable
pointers to point to the same implementation.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.