Re: Structure alignment changes when a constructor or destructor is added

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you.  This was helpful.  I'd been looking through the C++98 spec
but some parts of it are still difficult to mentally parse.  I had
found references elsewhere to the Itanium ABI, but not the actual
document so thanks for that link.  I understand now that it is not a
bug, it is certainly an oddity that you can generate better packing by
adding a constructor.  And it will make compatibility with the ABI of
our other platform impossible as most of the classes and structs have
constructors.

Bruce


On Wed, Dec 7, 2011 at 12:59 PM, Marc Glisse <marc.glisse@xxxxxxxx> wrote:
> On Wed, 7 Dec 2011, Marc Glisse wrote:
>
>> And for std::tuple, this implies that:
>> struct A { long a; char b; };
>
>
> Argh, pasto... It was:
> struct A { long a; char b; A(double); };
>
>
>> sizeof(std::tuple<A,char>)==24
>> sizeof(std::tuple<char,A>)==24
>> because std::tuple has A as a member. If it had A as a base class, one of
>> those would be 16.
>>
>> The ABI is fun :-)
>
>
> --
> Marc Glisse


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux