Synopsis: | The "continue" statement shall not be used. |
Language: | C |
Severity Level: | 6 |
Category: | Statement and Blocks |
Description: |
Justification "continue" statements cause breaks in the normal structured control flow of a program. For this reason they shall be avoided as they affect the readability and maintainability of the code. Example 1 for (i = 0; i < n; i++) { if (a[i] < 0) { /* process negative term */ continue; /* WRONG */ } /* Process positive term */ } Example 2 for (i = 0; i < n; i++) { if (a[i] < 0) { /* Process negative term */ } else /* a[i] >= 0 */ /* RIGHT */ { /* Process positive term */ } } |