AutosarC++19_03-M9.6.4¶
Named bit-fields with signed integer type shall have a length of more than one bit
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
The values which may be represented by a bit-field of length one may not meet developer
expectations. Anonymous signed bit-fields of any length are allowed.
Example
struct S
{
signed int a : 1; // Non-compliant
signed int : 1; // Compliant
signed int : 0; // Compliant
signed int b : 2; // Compliant
signed int : 2; // Compliant
};
Note
For legal reasons, this rule’s description is not part of the public documentation.