There shall be no explicit floating-integral conversions of a cvalue expression
There shall be no explicit floating-integral conversions of a cvalue expression.
Expressions flagged by this checker follow the detailed specifications for cvalue expressions from the MISRA® C++ documentation.
If you evaluate an expression and later cast the result to a different type, the cast has no effect on the underlying type of the evaluation (the widest of operand data types in the expression). For instance, in this example, the result of an integer division is then cast to a floating-point type.
short num; short den; float res; res= static_cast<float> (num/den);
There shall be no explicit floating-integral conversions of a cvalue expression.
Complex expression of underlying type
typeBeforeConversion may only be cast to narrower
integer type of same signedness, however the destination type is
typeAfterconversion.
If you expect a rule violation but do not see it, refer to Coding Standard Violations Not Displayed.
| Group: Expressions |
| Category: Required |