[cxx-abi-dev] Question about tail padding
scott douglass
sdouglass at arm.com
Fri Aug 16 13:17:05 UTC 2002
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? And doing this:
B b;
D d;
(B&)d = b; // must not clobber 'd.bf2'
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.
More information about the cxx-abi-dev
mailing list