
26 Oct
2010
26 Oct
'10
9:54 p.m.
- /* Round up to make sure size gives nice stack alignment */
- DEFINE(GENERATED_GBL_DATA_SIZE,
(sizeof(struct global_data)+15) & ~15);
This has already been applied, sooner than usual. Isn't it cleaner to force alignment on the structure itself? This way different architectures may use different values, if the need arises.
This shows it.
struct a { int i; } __attribute__((aligned(16)));
struct b { int i; };
int main() { printf("%i %i\n", sizeof(struct a), sizeof(struct b)); }
It prints "16 4" as expected.
/alessandro