Boost logo

Boost :

Subject: Re: [boost] Silent change in boost 1.36 alignment_of<> template withgcc 4.3
From: John Maddock (john_at_[hidden])
Date: 2008-11-09 05:13:29


Jon Biggar wrote:
>> In boost 1.36, boost::alignment_of<> was changed to use the builtin
>> __alignof__() if gcc version was 4.3 or greater rather than using
>> calculating alignement using:
>>
>> template <typename T>
>> struct alignment_of_hack
>> {
>> char c;
>> T t;
>> alignment_of_hack();
>> };
>>
>> Unfortunately, this broke some code I had written that did structure
>> introspection, because gcc's __alignof__() returns 8 for double on
>> the
>> x86 architecture, but actually only aligns doubles on 4 byte
>> boundaries inside structures.

Hmmm, do you have a test case?

I ask because the type_traits tests compare the result of
alignment_of<>::value with the actual alignment inside a struct... and the
tests are all passing.

Thanks, John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk