Synopsis: | There shall be no return statement in a void function. |
Language: | C |
Severity Level: | 9 |
Category: | Statement and Blocks |
Description: |
Justification There is no need for a return statement in a void function. Absence of a return statement prevents adding an expression to the return statement. Example 1 void f(void) { /* any statement */ return (i); /* WRONG */ } Example 2 void f(void) { /* any statement */ /* no return statement */ /* RIGHT */ } |