This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
alignment/padding of structures
- From: "Frederic Christen" <Christen at fka dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 24 Jan 2002 17:34:37 +0100
- Subject: alignment/padding of structures
- Organization: fka
I've a problem in understanding the behaviour of
alignment and padding between MSVC++ and gcc-2.9.95 (Linux).
example:
struct foo {
double a;
double b;
float c;
};
with MSVC++ and #pragma pack(4) set : sizeof(foo) = 20
with MSVC++ and #pragma pack(8) set : sizeof(foo) = 24
(the alternative Zp'x' flag causes the same effect)
but with gcc there is no effect of the #pragma:
with gcc and #pragma pack(4) set : sizeof(foo) = 20
with gcc and #pragma pack(8) set : sizeof(foo) = 20
Which compiler-flag has to be set to get the same alignment/
padding as with MSVC++ ?