Hm... why is it that, when I print sizeof(struct MyStruct)
, it outputs 3 (instead of 2) for this code?
#pragma pack(push, 1)
struct MyStruct
{
unsigned char a : 6;
union
{
struct
{
unsigned int b : 9;
};
};
};
#pragma pack(pop)
In case it matters, I'm running MinGW GCC 4.5.0 on Windows 7 x64, but honestly, the result is weird enough for me that I don't think the compiler and the OS matter too much here. :\