The compiler is the data allocation space

zhaozj2021-02-16  51

Generally, the default association conditions can be changed by the following method:

• Use the pseudo command #pragma Pack ([N])

#pragma pack ([n]) The pseudo-instruction allows you to select a compiler to be a governor policy taken by the data allocation space.

For example, after using the #pragma pack (1) pseudo, the spatial allocation of each member of the TEST structure is aligned according to one byte, the format is as follows:

#pragma pack (push) // Save the alignment status

#pragma pack (1)

// Define your structure

// ..........

#pragma pack (POP)

Moderator:

Alignment has always been a problem that beginners is confused, I hope this article can help

转载请注明原文地址:https://www.9cbs.com/read-21489.html

New Post(0)