Query module CheckingReturnValues
- Unchecked return value
- The return value of each non-void function call should be checked for error conditions, or cast to (void) if irrelevant.
Provides classes and predicates for working with C/C++/ObjC/ObjC++ code.
In its full generality, the rule applies to all functions that return non-void, including things like ‘printf’ and ‘close’, which are routinely not checked because the behavior on success is the same as the behavior on failure. The recommendation is to add an explicit cast to void for such functions. For code bases that have not been developed with this rule in mind, at least for such commonly ignored functions, it may be better to add them as exceptions to this whitelist predicate.