Original Post
What''s wrong with this code? Isn''t it suppoused to write 8 (sizeof())?
#include <iostream>
using namespace std;
#pragma pack(push, 1)
struct the_struct
{
unsigned int aaa : 32;
unsigned int bbb : 16;
unsigned int ccc : 8;
};
#pragma pack(pop)
void
main()
{
the_struct blahblah;
blahblah.aaa = 1;
blahblah.bbb = 1;
blahblah.ccc = 1;
cout << sizeof(blahblah) << endl;
}
That struct *should* be 7 bytes, if I''m right.
I''ve also tried using #include <pshpack1.h> and #include <poppack.h> with the same results.