引用:#pragma pack(push, 4)
#pragma pack(pop)
可以看看下面的程序会输出什么?
引用:#include
#pragma pack(push, 4)
struct a
{
short v1;
int v2;
};
struct b
{
short v1;
short v2;
char c;
};
struct c
{
struct a v3;
struct b v4;
};
int main()
{
printf("%d\n", sizeof(short));
printf("%d\n", sizeof(char));
printf("%d\n", sizeof(struct a));
printf("%d\n", sizeof(struct b));
printf("%d\n", sizeof(struct c));
}
#pragma pack(pop)
dutian 于 2008-08-06 12:58:42发表:
一般也用不到吧,对齐不好,小心程序挂了
akaedu008 于 2008-08-06 09:55:04发表:
(6)m:b
hackersea 于 2008-08-05 00:20:02发表:
2
1
8
6
16
:0wl;l1