![]() |
![]() |
2204 | ![]() |
||||
![]() | |||||||
| Bracing and Indentation | |||||||
This switch case label is not aligned with the controlling switch statement. The Plum Hall C Programming Guidelines recommend that 'case' statements should be aligned to match the controlling 'switch' statement in all three common bracing styles (exdented, indented and K&R). For example:
/*PRQA S 2017,3120,3198,3199,3203,3227,3408 ++*/
extern void foo(int n)
{
int r;
switch (n)
{
case 1: /* OK */
r = 2;
break;
case 2: /* Message 2204 */
r = 3;
break;
case 3: /* Message 2204 */
r = 4;
break;
case 4: /* Message 2204 */
r = 5;
break;
default: /* OK */
r = 0;
break;
}
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |