Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

__attribute__ ((aligned(8))) doesn't work with typedefs

807578Mar 14 2007 — edited Jul 6 2007
I'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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2007
Added on Mar 14 2007
5 comments
437 views