...
It is implementation-defined whether the specifier int
designates the same type as signed int
or the same type as unsigned int
for bit fields. According to the C standard [ISO/IEC 9899:2011], C integer promotions also require that "if an int
can represent all values of the original type (as restricted by the width, for a bit-field), the value is converted to an int
; otherwise, it is converted to an unsigned int
."
...
CERT C++ Secure Coding Standard: INT12-CPP. Do not make assumptions about the type of a plain int bit-field when used in an expression
ISO/IEC 9899:2011 Section Section 6.3.1.1, "Boolean, characters, and integers," and Section 6.7.2, "Type specifiers"
ISO/IEC TR 24772 "STR Bit Representationsrepresentations"
MISRA Rule 12.7
Bibliography
...