The value of a composite expression shall not be assigned to an object with wider essential type
The value of a composite expression shall not be assigned to an object with wider essential type.
A composite expression is a nonconstant expression using a composite operator. In the Essential Type Model, composite operators are:
Multiplicative (*, /, %)
Additive (binary +, binary -)
Bitwise (&, |, ^)
Shift (<<, >>)
Conditional (?, :)
If you assign the result of a composite expression to a larger type, the implicit conversion can result in loss of value, sign, precision, or layout.
For more information on essential types, see MISRA C:2012 Rule
10.1.
The composite expression is assigned to an object with a wider essential type.
If you expect a rule violation but do not see it, refer to Coding Standard Violations Not Displayed.
| Group: The Essential Type Model |
| Category: Required |
| AGC Category: Advisory |