![]() |
![]() |
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;
}
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |