G++ ABI: bug in non-POD class tail-padding reuse?
Mark Mitchell
mark@codesourcery.com
Wed Nov 13 08:36:00 GMT 2002
--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
More information about the Gcc
mailing list