![]() |
![]() |
2019 | ![]() |
||||
![]() | |||||||
| Switch statements | |||||||
This switch case label is located in this switch statement within a nested block. This is not illegal syntax, but is it really intended ?! The C language allows for great freedom in the way that a switch statement can be constructed; but locating a case statement in this way is almost certainly a mistake. For example:
/*PRQA S 2017,3120,3227,3333,3408 ++*/
extern int foo(int i, int p)
{
int ret = p;
switch (i)
{
case 0:
if (ret > 2)
{
case 1: /* Message 2019 */
ret = 2;
break;
}
break;
case 2:
ret = 3;
break;
default:
ret = 4;
break;
}
return ret;
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |