#pragma pack(push) //保存对齐状态 #pragma pack(4)//设定为4 字节对齐 struct test { char m1; double m4; int m3; }; #pragma pack(pop)//恢复对齐状态