mirror of
https://github.com/huihut/interview.git
synced 2024-03-22 13:10:48 +08:00
修改#pragma pack(n)
This commit is contained in:
parent
900104ecbd
commit
7fe77b9a23
|
@ -164,12 +164,14 @@ assert( p != NULL );
|
||||||
```cpp
|
```cpp
|
||||||
#pragma pack(push) //保存对齐状态
|
#pragma pack(push) //保存对齐状态
|
||||||
#pragma pack(4)//设定为4字节对齐
|
#pragma pack(4)//设定为4字节对齐
|
||||||
|
|
||||||
struct test
|
struct test
|
||||||
{
|
{
|
||||||
char m1;
|
char m1;
|
||||||
double m4;
|
double m4;
|
||||||
int m3;
|
int m3;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)//恢复对齐状态
|
#pragma pack(pop)//恢复对齐状态
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user