[cxx-abi-dev] Question about tail padding

Jason Merrill jason at redhat.com
Fri Aug 16 13:59:26 UTC 2002


On Fri, 16 Aug 2002 14:17:05 +0100, scott douglass <sdouglass at arm.com> wrote:

> At 01:57 PM 16-08-02 +0100, you wrote:
>>On Fri, 16 Aug 2002 12:00:54 +0100, scott douglass <sdouglass at arm.com> wrote:
>>
>>> If the tail padding must not be changed this will be quite inefficient
>>> when there is a trailing bit-field -- it makes you wish there were
>>> separate whole-object op= and a sub-object op=.
>>
>>dsize for a class is measured in bytes, so bit-fields shouldn't make a
>>difference.
>
> I don't think the implicit copy assignment for B can copy all dsize bytes in this case:
>
> struct B {
>     virtual void f(); // B is non-POD
>     int bf1:3;
> };
>
> struct D : B {
>     D();
>     int bf2:3;
> };
>
> Won't bf1 & bf2 be in the same byte?

Nope, the base gets nvsize(B) bytes of space.

> A related thought: I think constructors, including copy constructors,
> don't have to worrry about preseving tail padding because after they
> finish none of the derived fields are valid anyway.

Makes sense to me.

Jason



More information about the cxx-abi-dev mailing list