AUTOSAR C++14 Rule M5-0-4
An implicit integral conversion shall not change the signedness of the underlying type
描述
规则定义
An implicit integral conversion shall not change the signedness of the underlying type.
理由
一些从有符号数据类型到无符号数据类型的转换可能会导致实现定义的行为。您可能会看到转换导致的意外结果。
Polyspace 实现
检查项会标记从有符号整数数据类型到无符号整数数据类型的隐式转换,或者从无符号整数数据类型到有符号整数数据类型的隐式转换。
检查项假定 ptrdiff_t
是一个有符号整数。
故障排除
如果您预期会出现违规,而 Polyspace® 未报告该违规,请参阅诊断为何编码规范违规未按预期显示。
示例
检查信息
组:表达式 |
类别:必需、自动 |
版本历史记录
在 R2019a 中推出