class Test
{
struct
{
unsigned has_some_value1: 1;
unsigned has_some_value2: 1;
} info;
};
What does unsigned has_some_value1: 1;
means?
Should be the following statement true: sizoef(type) == bit1 + ... + bitn
?
class Test
{
struct
{
unsigned has_some_value1: 1;
unsigned has_some_value2: 1;
} info;
};
What does unsigned has_some_value1: 1;
means?
Should be the following statement true: sizoef(type) == bit1 + ... + bitn
?
These are called "bit fields". has_some_value1
occupies one bit. has_some_value2
also occupies one bit—maybe the next physical bit in memory, or maybe not (depends how your compiler is configured to handle bit field alignment).
A bitfield in a nonstatic instance of an un-named struct called "info", which is itself a member of "Test".