This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: G++ ABI: bug in non-POD class tail-padding reuse?
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Wed, 13 Nov 2002 08:28:45 -0800
- Subject: 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