MISRAC++2023-7.0.4
In this section:
Synopsis
(Required) The operands of bitwise operators and shift operators shall be appropriate
Enabled by default
Yes
Severity/Certainty
Medium/High

Full description
Inappropriate operand to bitwise operator found
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
void example(int n) {
n << 8u; // Non-compliant - left operand is signed
}
The following code example passes the check and will not give a warning about this issue:
void example(unsigned int n) {
n << 8u;
}