...
This compliant solution assumes that the range of values of type float is greater than that of an int, as is the case in most implementations. Unfortunately, there is no safe way to inquire about this assumption in the code short of already knowing the implementation. Converting INT_MAX to float is a problem on many implementations, resulting in a number one that is one greater than the value of INT_MAX. Converting INT_MIN to float is a problem on many implementations, resulting in a number one less that is one less than the value of INT_MIN.
...
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
|
| Can detect some violations of this rule. However, it does not flag implicit casts, only explicit ones | |||||||
| MISRA_CAST | Can detect instances where implicit float conversion is involved: implicitly converting a complex expression with integer type to floating type, implicitly converting a double expression to narrower float type (may lose precision), implicitly converting a complex expression from | |||||||
5.0 |
| Can detect violations of this rule with CERT C Rule Pack | |||||||
| LDRA tool suite |
| 435 S, 93 S | Partially implemented | ||||||
| Parasoft C/C++test | 9.5 | MISRA2004-10_1_d | Partially implemented | ||||||
| PRQA QA-C |
| 4450, 4451, | Partially implemented |
Related Vulnerabilities
...