#include
#if defined(_ALIGN_PACKED_)
#pragma options align=packed
#else
#pragma pack(1)
#endif
typedef struct
{
char s1;
unsigned short int s2;
unsigned int s3;
}AFAALIGN,*PAFAALIGN;
int main()
{
printf("sizeof(AFAALIGN) is %d\n",sizeof(AFAALIGN) );
printf("sizeof(unsigned short int) %d\n",sizeof(unsigned short int));
getchar();
return 0;
}
如果没定义宏_ALIGN_PACKED_,sizeof(AFAALIGN)的值为7,否则结果为8。
阅读(319) | 评论(0) | 转发(0) |