Are these code spinets the same?
Not really. Your two examples are actually very different.
In the first example, you get an array of sse_t objects. The sse_t object sse_t guaranteed only 4-byte alignment. But since the entire array is aligned to 64 bytes, each sse_t object will be correctly aligned to access the SSE.
In your second example, you force each sse_t object sse_t align with 64 bytes. But each sse_t object has only 16 bytes. Thus, the array will be 4 times larger. (You will have 48 bytes of padding at the end of each sse_t object).
struct objA { float sse_data[4]; }; struct objB { float sse_data[4]; } __attribute((aligned(64))); int main(){ cout << sizeof(objA) << endl; cout << sizeof(objB) << endl; }
Output:
16 64
I am sure that the second case is not what you want.
source share