【发布时间】:2012-09-19 10:56:18
【问题描述】:
struct Test
{
int a;
char b;
int c;
} __attribute__((packed, aligned( 128 )))test;
sizeof(test) 返回 128。
为什么尺寸不是 9 ?
内存是四舍五入到128的倍数吗?
例如:
struct Test
{
int b;
char c;
} test;
sizeof(test) 返回 8(四舍五入为 8 的倍数)
【问题讨论】:
标签: gcc struct memory-alignment