Synopsis: | Only variables and parameters that are used shall be declared. |
Language: | C |
Severity Level: | 4 |
Category: | Declarations |
Description: |
Justification Variables and parameter declarations that are not used clutter the program text. Note In cases where you cannot remove a declaration, you can explicitly ignore the violation by inserting this comment in front of a declaration: /*@unused@*/. Using the aforementioned comment with a variable that is used will result in a violation. Example int method( int status, /* RIGHT, parameter used */ void *context_ptr, /* WRONG, unused parameter */ /*@unused@*/ handle handle) /* RIGHT, commented unused param */ { return status; } |