MISRA C++:2023 Rule 7.0.5
Integral promotion and the usual arithmetic conversions shall not change the signedness or the type category of an operand
Since R2024b
Description
Rule Definition
Integral promotion and the usual arithmetic conversions shall not change the signedness or the type category of an operand.
Rationale
Some conversions from signed to unsigned data types can lead to implementation-defined behavior. You can see unexpected results from the conversion.
Polyspace Implementation
The checker flags implicit conversions from a signed to an unsigned integer data type or vice versa.
The checker assumes that ptrdiff_t
is a signed integer.
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: Standard Conversions |
Category: Required |
Version History
Introduced in R2024b