![]() |
![]() |
1460 | ![]() |
||||
![]() | |||||||
| Switch statements | REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers | ||||||
The controlling expression of this switch statement is of enum type but the value of this case expression is not consistent with any of the constants in the enumeration. It is quite possible to store arbitrary values within an enum object but this would only happen as a result of a mistake or some very bad practice. This case label will therefore be unreachable under normal circumstances. For example:
/*PRQA S 1-9999 ++*/
/*PRQA S 1460, 1470 --*/
enum SIZE { small, medium, large };
int paint (enum SIZE box)
{
switch (box)
{
case small:
return 10;
case 1: /* Message 1470 */
return 30;
case 5: /* Message 1460 and 1470 */
return 20;
default:
return 0;
}
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |