This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

vtable origin in class information


Dear GCC supporters,

I would like to ask a question regarding the vtable information a
class has during compilation.

Assume that we have the following classes:
------------------------------
class A {
public:
virtual int virtFuncA(){ return 0xA; }
};

class B {
public:
virtual int virtFuncB(){ return 0xB; }
};

class C: public A, public B{
public:
int virtFuncA(){ return 0xCA; }
int virtFuncB(){ return 0xCB; }
virtual int virtFuncC(){ return 0xC; }
};

class D{
public:
virtual int virtFuncD(){ return 0xD; }
};

class E: public C, public D{
public:
int virtFuncA(){ return 0xEA; }
int virtFuncB(){ return 0xEB; }
int virtFuncC(){ return 0xEC; }
int virtFuncD(){ return 0xED; }
};
------------------------------
---

In the end class E will have three vtables. First two originate from
class C and third one originate from class D.
When we have the tree object of class E during compilation, could we
tell that its first two vtables originate from class C and third one
from class D?

Class C will have two vtables. The first one is a vtable originating
from class A merged with the vtable of class C itself, and the second
one is a vtable originating from class B.
During compilation, could we tell that the first vtable originates
from both class A and C itself?

If this is possible, could you please tell with which functions of gcc
this can be done?

I really appreciate any help you can provide.

Best, Enes


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]