This is a draft version of a MISRA C++ 202x rule proposed for public review.
MISRA Rule 12.2.3
Category: Required
Analysis Type: Decidable,Single Translation Unit
Rationale
A single-bit signed bit-field is unlikely to behave in a useful way and its presence is likely to indicate an error.
Note: anonymous signed bit-fields of any length are allowed as they cannot be accessed.
Example
struct S
{
signed int a : 1; // Non-compliant
signed int : 1; // Rule does not apply
signed int : 0; // Rule does not apply
signed int b : 2; // Compliant
int c : 1; // Non-compliant
};
Copyright The MISRA Consortium Limited © 2023