![]() |
![]() |
0770 | ![]() |
||||
![]() | |||||||
| Control flow | |||||||
A 'continue' statement has been used to jump to the end of an iteration statement, i.e. a while, do ... while or for statement. Many coding standards recommend that 'continue' statements should be avoided. This can usually be achieved by some simple recoding:
while ( ... )
{
...
if ( condition )
{
continue;
}
...
}
can be replaced with ...
while ( ... )
{
...
if ( ! condition )
{
...
}
}
For example:
/*PRQA S 2017,3408 ++*/
#define VALUE 1000
extern void foo1(int gi)
{
while (gi != 0)
{
gi--;
if (gi == VALUE)
{
continue; /* Message 0770 and 2005 */
}
}
}
extern void foo2(int gi)
{
while (gi != 0)
{
gi--;
if (gi != VALUE)
{
/* SOME CODE */
}
}
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |