Synopsis: | Function return values that are error codes shall not be ignored. |
Language: | C |
Severity Level: | 6 |
Category: | Statement and Blocks |
Description: |
Justification If you ignore an error code and an error occurs, it will be very hard to find the root cause. Example 1 static int ccbb_example(void) { /* log error code */ return e; } void CCBB_X(void) { ccbb_example(); /* WRONG: return value is ignored */ } Example 2 static int ccbb_example(void) { return (e); } void CCBB_X(void) { if (ccbb_example() == OK) /* RIGHT */ { ... } } |