Many functions return useful values whether or not the function has side effects. In most cases, this value is used to signify whether the function successfully completed its task or if some error occurred. (See ERR02-C. Avoid in-band error indicators.) Other times, the value is the result of some computation and is an integral part of the function's API.
Section 6.8.3 of the C standard Standard [ISO/IEC 9899:2011] states:
The expression in an expression statement is evaluated as a void expression for its side effects.
...
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
| CHECKED_RETURN | Finds inconsistencies in how function call return values are handled. Coverity Prevent cannot discover all violations of this recommendation, so further verification is necessary. | |||||||
Splint |
|
|
| ||||||
Compass/ROSE |
|
|
| ||||||
| SV.RVT.RETVAL_NOTTESTED |
| |||||||
| 382 S | Fully implemented. | |||||||
| ignrtrn | Fully implemented. | |||||||
PRQA QA-C |
| 3200 | Fully implemented. |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
...
...
...
...
...
Passing parameters and return values |
...
[CSJ] |
MITRE CWE |
...
...
Improper check for unusual or exceptional conditions |
...
Bibliography
[ISO/IEC 9899:2011] | Section 6.8.3, "Expression and Null Statements" |
---|
...