08-01-2008, 02:44 PM
What about following case:
Rule 6.5 explicitly says that \"Bit fields of type signed int shall be at least 2 bits long.\" (or \"Bit fields of signed type shall be at least 2 bits long.\" in TC1).
This bit field is clearly smaller than 2 bits, but it serves other purpose than \"normal\" positive-size bit fields.
Should the code be changed to use \"unsigned int\" type (the rule would not apply), or is the 0-size bit field an exception to this rule?
Code:
struct s {
signed int : 0; /* Is Rule 6.5 violated? */
};
Rule 6.5 explicitly says that \"Bit fields of type signed int shall be at least 2 bits long.\" (or \"Bit fields of signed type shall be at least 2 bits long.\" in TC1).
This bit field is clearly smaller than 2 bits, but it serves other purpose than \"normal\" positive-size bit fields.
Should the code be changed to use \"unsigned int\" type (the rule would not apply), or is the 0-size bit field an exception to this rule?