在Polyspace 代码检查之后,我得到“从int16 到unsigned int16 的转换可能会溢出”。
uint16 lData = 0x00u;
sint16 AnalogInputValue;
lData = (uint16)AnalogInputValue; => This line causes Polyspace error
类型转换应该完成这项工作吗?根据 Polyspace 没有:)
您首先需要确保 AnalogInputValue 不包含任何负数,然后再将其转换为 uint16。如果您不这样做,那么您可能会在类型转换中丢失数据。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句