![]() |
![]() |
1319 | ![]() |
||||
![]() | |||||||
| C++ compatibility | REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers | ||||||
An object of enum type is being modified using an increment or decrement operator. An object of enum type should never be permitted to contain a value which is not one of its defined enumeration constants, but unfortunately the C language imposes no constraints of this nature. If an increment or decrement operator is applied to an enum object, there is a distinct risk that the value of the enum object will be modified to an inappropriate value (in fact, such operations are not permitted in C++). For example:
/*PRQA S 1481,2017,2211,2213,3227,3408,3447,3602 ++*/
enum ET { A = 2, B = 4, C = 6};
extern enum ET ex;
extern void foo(void)
{
++ex; /* Message 1319 */
ex--; /* Message 1319 */
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |