|
Boost : |
Subject: [boost] Silent change in boost 1.36 alignment_of<> template with gcc 4.3
From: Jon Biggar (jon_at_[hidden])
Date: 2008-11-08 12:30:46
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.
What do people think about adding a struct_alignment_of<> template that
uses the old logic to compute alignment inside a struct?
-- 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