__attribute__ ((aligned(8))) doesn't work with typedefs
807578Mar 14 2007 — edited Jul 6 2007I'm currently using the February 2007 version of Sun Studio Express in order to get support for __attribute__ ((aligned(8))).
While trying to create a long long type that would be aligned to an 8 bytes boundary on x86 instead of the usual 4 bytes, I discovered that the __attribute__ ((aligned(8))) directive only works on variables, not on typedefs...
if I use:
long long __attribute__((aligned (8))) foo;
then foo is 8 bytes aligned as expected.
If I use:
typedef __attribute__ ((aligned (8))) long long bar;
bar foo;
then foo is 4 bytes aligned instead of the expected 8.
This behavior is not present in gcc where foo will get an 8 bytes alignment in both cases. Is there any way to fix this or to make it works?