I l @ ve RuBoard |
Answer 12-1: The problem is that we have a single signed-integer-bit field. A three-bit-wide signed-integer field can take on the following values: struct foo { int three_bits:3; };
A two-bit-wide signed-integer field can take on the following values: struct foo { int two_bits:3; };
A one-bit-wide signed-integer field can take on the following values: struct foo { int one_bit:1; };
So the two values of this bit field are 0 and -1. That means that 1 can never be stored in this field. A unsigned bit field of width 1 can hold the values 0 and 1. Using the declaration unsigned int valid:1 makes the program work correctly. |
I l @ ve RuBoard |