when arranging structors the compiler aligns all numeric data types (short, long, _int64, floats and doubles) and user-defined data types (e.g. other structures) on even byte boundry for faster access time. And yes, the default byte alignment is compiler specific, and yes, that can be a big problem when transferring data from one computer or compiler to another. Most database programs use single byte alignment for compatible purposes and to keep file size as small as possible-- they don't want or need all that wasted file space.(see below example)
Most compilers have switches or #pragma to override the default. For example, VC++ 6.0 is like this
Code:
#pragma pack(1) // align all items on single byte boundry
class C {
char c;
int int1;
int int2;
int i;
long l;
short s;
};
#pragma pack() // use default byte alignment
In the above example, there will be no holes in the class (or structure)