![]() |
![]() |
1481 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Enum types | REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers | ||||||
The value of an enum object is being modified using an increment or decrement operator (++ or --). This is permitted in the C language but it is dangerous because it could result in the object containing a value which is not a valid member of the enumeration. For example:
/*PRQA S 2017,2211,2213,3120,3227,3408,3447,3448,3602,4130 ++*/
typedef enum { RED = 2, GREEN = 4, BLUE = 6 } COLOUR;
extern COLOUR col;
extern void foo(void)
{
++col; /* Message 1481 and 1319 */
--col; /* Message 1481 and 1319 */
return;
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |