
9 Nov
2008
9 Nov
'08
10:13 a.m.
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.