![]() |
![]() |
2001 | ![]() |
||||
![]() | |||||||
| Control flow | |||||||
A goto statement has been used. Use of a goto statement is generally discouraged in coding standards, although they can be justified in certain circumstances. Note that backward jumps contribute to the number-of-backward-jumps (STBAK) metric and jumps out of control structures will contribute to the knot count (STKNT) metric. For example:
/*PRQA S 2017,2201,2461,3227,3408,3416,3442,3447,3602 ++*/
extern volatile int n;
extern int ef(void);
extern int foo(int m)
{
int i;
int r = 0;
while (n > 0)
{
for (i = 0; i < m; ++i)
{
r = ef();
if (r < 0)
{
goto E; /* Message 2001 */
}
}
}
E: return r; /* Message 2015 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |