Patrik Stridvall wrote:
On MSVC it does matter in the following example whether n is 4 or 8. Or 16 for that matter eventhough that gives the same result as 8.
#ifdef _MSC_VER typedef __int64 longlong_t; #else typedef long long longlong_t; #endif
#pragma pack(n) typedef struct { char x; longlong_t y; /* offset is 4 if n = 4, but is 8 if n = 8 or n = 16*/ } longlong_n; #pragma pack()
I would assume that MSVC and GCC use different structure layouts even without any #pragma pack(), because the default aligment of 8-byte data types is different.
As I mentioned in my other mail, GCC should use the same layout as MSVC if you compile with -malign-double.
Bye, Ulrich