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]

Re: Double abstract class Inheritance concern.


On Mar 28, 2004, Tiago Stein <tiago@lisha.ufsc.br> wrote:

> class A{ };
> class B :public A{ };
> class C: public A{ int g; };
> class D: public B, public C { unsigned int foo; };

> Why sizeof class D is 12? Should not be 8? Why the extra size from the
> empty classes is not eliminated this time? Is this due to any rules in the
> standard?

D::B::A and D::C::A must have different addresses.

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


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