- 论坛徽章:
- 17
|
回复 1# jonas_mao
由于a1是一个柔性数组(C99标准称其为Flexible array,作用等同于GCC中的零长数组)成员,所以它不占用空间,VC++默认是按8对齐,所以sizeof的结果是8,你pack(1)以后结果是4也是正常的啊。
pack gives control at the data-declaration level. This differs from compiler option /Zp, which only provides module-level control. pack takes effect at the first struct, union, or class declaration after the pragma is seen. pack has no effect on definitions. Calling pack with no arguments sets n to the value set in the compiler option /Zp. If the compiler option is not set, the default value is 8 |
|