![]() |
![]() |
3605 | ![]() |
||||
![]() | |||||||
| K+R compatibility | REFERENCE - ISO:C90-6.6.4.2 The switch Statement - Constraints | ||||||
The type of the controlling expression in this switch statement is an integral type which cannot be represented in type int. Switch expression could not be of type unsigned int, long or unsigned long in old (pre ISO) compilers. ISO:C allows the switch expression to be of any integral type. For example:
/*PRQA S 597,2016,2104,3120,3227,3408,3447,3602 ++*/
extern int g;
extern void fsi(int si)
{
switch(si) /* */
{
case 1:
++g;
break;
case 2:
--g;
break;
default:
break;
}
}
extern void fsl(signed long sl)
{
switch(sl) /* Message 3605 */
{
case 1:
++g;
break;
case 2:
--g;
break;
default:
break;
}
}
extern void ful(unsigned long ul)
{
switch(ul) /* Message 3605 */
{
case 1:
++g;
break;
case 2:
--g;
break;
default:
break;
}
}
No MISRA-C:2004 Rules applicable to message 3605
![]() | ||
| 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 |