AUTOSAR C++14 Rule M9-6-4
Named bit-fields with signed integer type shall have a length of more than one bit
Since R2020b
Description
Rule Definition
Named bit-fields with signed integer type shall have a length of more than one bit.
Rationale
Variables that have signed integer bit-field types of length one bit might have values
that do not meet developer expectations. For instance, signed integer types of a fixed width
such as std16_t
have a two's complement representation. In this
representation, a single-bit variable has just the sign bit and the variable value might be
0 or -1.
Polyspace Implementation
The checker flags declarations of named variables having signed integer bit-field types of length equal to one.
Bit-field types of length zero are not flagged.
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Classes |
Category: Required, Automated |
Version History
Introduced in R2020b