__attribute__ 可以设置函数属性(Function Attribute )、变量属性(Variable Attribute )和类型属性(Type Attribute )
aligned:
struct S
{
short b[3];
}__attribute__ ((aligned (2)));
int main()
{
struct S s;
printf("size = %lu\n",sizeof(s));
return 0;
}
aligned (n) :n必须的2的幂
结果: aligned (2) sizeof(s)= 6
aligned (4) sizeof(s)= 8
aligned (16) sizeof(s)= 16
----------------------------------------------------------------------------------------------------------
原文:https://www.cnblogs.com/xpylovely/p/11265579.html