This is the mail archive of the
mailing list for the GCC project.
C++ vtable ordering
- From: "Deshpande, Rohini (STSD)" <rohini dot deshpande at hp dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 4 Jul 2011 05:12:59 +0000
- Subject: C++ vtable ordering
We have introduced a new virtual function in between existing virtual functions in a Class definition. This is compiled into a library. Usually this library needs to be backward compatible.
The programs that use this library fail if they are not recompiled, even though they do not make use of this new virtual function. These programs do not derive from the Class, they just link to the library.
Is this because of "The order of the virtual function pointers in a virtual table is the order of declaration of the corresponding member functions in the class."( Itanium C++ ABI)
Now if that virtual function is moved at the end without disturbing the ordering of existing virtual functions, then the library tends to be backward compatible(not sure). The programs work with the latest library even without recompilation. So is this fix correct? Or are there any risks involved?