grady
10-11-2002, 05:36 PM
if you have a struct
struct bloat
{
short x;
long y;
short z;
};
sizeof( bloat ) = 12 because the compiler pads the 2 byte shorts to 4 bytes however
struct bloat
{
long x;
short y;
short z;
};
doesn't need the padding and will be 8 bytes long.
I think in MSVC their is a pragma directive that can force the compiler to not do this. Is there a similar thing I could use to get gcc/g++ to not pad the 2 byte values.
struct bloat
{
short x;
long y;
short z;
};
sizeof( bloat ) = 12 because the compiler pads the 2 byte shorts to 4 bytes however
struct bloat
{
long x;
short y;
short z;
};
doesn't need the padding and will be 8 bytes long.
I think in MSVC their is a pragma directive that can force the compiler to not do this. Is there a similar thing I could use to get gcc/g++ to not pad the 2 byte values.