Re: how to compute offset of data member at compile time (virtual class)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 25 Oct 2007 17:57:11 +0100
Andrew Haley <aph-gcc@xxxxxxxxxxxxxxxxxxx> wrote:

> John Gateley writes:
>  > I need to compute the offset of a data member at compile time.
>  > The class has virtual functions, and so the offsetof macro does
>  > not work (why?).
> 
> Because it's a non-POD type.  See Section 9, Classes:
> 
>  > Is there a way to do this?
> 
> No.  Consider what happens with multiple and virtual inheritance.
> 

Thanks for the reply.

It seems to me that even with multiple
and virtual inheritance, the offset is a compile time constant.
It may be complex to determine it, but it doesn't change.

j
-- 
John Gateley <gateley@xxxxxxxxxx>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux