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: G++ ABI: bug in non-POD class tail-padding reuse?




--On Wednesday, November 13, 2002 10:21:22 AM +0100 Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:

Hi,

  It has been my understanding that the new ABI reuses tail-padding
for non-POD class-types.  However the sizeof() displayed for class B,
defined below, is different from what would have been expected.

More specifically, consider:

    #include <iostream>

    struct A {
       int i;
       char c;
    };

    struct B : A {
       char c;
    };
A is a POD, so we cannot reuse its tail padding.  If you throw in a
constructor in A, for example, you'll see that B's size shrinks.

--
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


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