[LLVMdev] Struct layout assumptions
Gordon Henriksen
gordonhenriksen at mac.com
Sun Mar 2 17:22:01 PST 2008
On Mar 2, 2008, at 15:47, Talin wrote:
> OK, so we come to the issue of inheritance: Suppose I have a class A
> and subclass B, each of which have two methods.
>
> A.vtable = { A.method1 *, A.method2 * }
> B.vtable = { { A.method1 *, A.method2 * }, B.method1 *, B.method2
> * }
>
> A.vtable = { A.method1 *, A.method2 * }
> B.vtable = { A.method1 *, A.method2 *, B.method1 *, B.method2 * }
>
> However, the problem here is that I don't know if its legal to
> bitcast from B.vtable to A.vtable. As far as I know, the optimizer
> might re-order the member fields, or muck with the padding.
Hi Talin,
Either form is perfectly safe.
— Gordon
More information about the llvm-dev
mailing list