标签:style http color ar div linux line new
VC6.0中的对齐方式:class X{ public: double a; float b; short c; char d; };
由于double占8Byte,float占4Byte,int占4Byte,short占2Byte,char占1Byte,
在VC6.0中按照最大字节数进行对齐,sizeof(X)=16
class X{
public:
float b;
double a;
short c;
char d;
};//sizeof(X)=24
Linux中的对齐方式:class X{ public: double a; float b; short c; char d; };在Linux中对齐按照最大4个字节对齐,没有8个字节,所以sizeof(X)=16class X{ public:float b;double a; short c; char d; };//sizeof(X)=16
class X{ public://float b;double a; short c; char d; };//sizeof(X)=12
class X{ public:float b;//double a; // short c; char d; };//sizeof(X)=8
标签:style http color ar div linux line new
原文地址:http://www.cnblogs.com/zzuzmy/p/3911721.html