#pragma pack(1) // 字节对齐
struct S
{
char ch;
short sh;
int i;
long l;
float f;
double d;
};
inline void TestPack()
{
printf("%d ", offsetof(S, ch));
printf("%d ", offsetof(S, sh));
printf("%d ", offsetof(S, i));
printf("%d ", offsetof(S, l));
printf("%d ", offsetof(S, f));
printf("%d ", offsetof(S, d));
}