|
Boost : |
Subject: Re: [boost] Silent change in boost 1.36 alignment_of<> template withgcc 4.3
From: Jon Biggar (jon_at_[hidden])
Date: 2008-11-09 11:23:33
John Maddock 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.
This is what the alignment_of test case outputs on my system:
alignment_of_test.cpp:78: The expression:
"::boost::alignment_of<double>::value"
had an invalid value (found 8, expected 4)
alignment_of_test.cpp:81: The expression: "::boost::alignment_of<
::boost::long_
long_type>::value" had an invalid value (found 8, expected 4)
That's with this version of gcc from Fedora 9:
gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC)
-- Jon Biggar jon_at_[hidden] jon_at_[hidden] jonbiggar_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk