![]() |
![]() |
2009 | ![]() |
||||
![]() | |||||||
| Switch statements | |||||||
This 'default' clause is not the final clause in the switch statement. This is quite legal but rather unconventional. For example:
/*PRQA S 2017,3120,3227,3408 ++*/
extern int foo(int n)
{
int r;
switch (n)
{
default: /* Message 2009 */
r = 0;
break;
case 1:
r = 5;
break;
case 3:
r = 10;
break;
case 5:
r = 20;
break;
}
return r;
}
MISRA-C:2004 Rules applicable to message 2009:
| Rule 15.3 (Required) | The final clause of a switch statement shall be the default clause. |
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index | Contents |