N
Nikolay Moskvichev
Hello All.
size of this struct is 2 for gcc or borland, and 4 for msvc,
can you please explain this for me?
#include <iostream>
#pragma pack(push,1)
struct bit_field {
unsigned f1 : 5;
unsigned f2 : 4;
unsigned f3 : 7;
};
#pragma pack(pop)
int main()
{
std::cout<<sizeof(bit_field)<<std::endl;
}
size of this struct is 2 for gcc or borland, and 4 for msvc,
can you please explain this for me?
#include <iostream>
#pragma pack(push,1)
struct bit_field {
unsigned f1 : 5;
unsigned f2 : 4;
unsigned f3 : 7;
};
#pragma pack(pop)
int main()
{
std::cout<<sizeof(bit_field)<<std::endl;
}