请教linux下的内存对齐和windows下的对齐方式?支持压缩是什么意思?

struct test
{
  char a;
  int b;
  double c;
 
}
在GCC下test 的大小是?,windows下的大小是??



struct test
{
  double c;
  char a;
  int b;
}
在GCC下test 的大小是?,windows下的大小是??

结论是什么啊???

作者: qq515383106   发布时间: 2011-04-03

The #pragma pack directive modifies the current alignment mode for only the members of structures whose declarations follow the directive. It does not affect the alignment of the structure directly, but by affecting the alignment of the members of the structure, it may affect the alignment of the overall structure according to the alignment mode.
你自己试一下就知道编译器default按什么方式对齐

作者: masterz   发布时间: 2011-04-03