![]() |
![]() |
1424 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Enum types | REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers | ||||||
Two objects of different enum types are being compared using a relational operator. Is this intended ? For example:
/*PRQA S 2017,2211,2213,3227,3408,3447,3602 ++*/
enum SIZE { SMALL = 1, MEDIUM = 2, LARGE = 3 };
enum COLOUR { RED = 2, GREEN = 4, BLUE = 6 };
extern enum COLOUR shade;
extern void foo(enum SIZE box)
{
if (box == shade) { } /* Message 1420 */
if (box != shade) { } /* Message 1420 */
if (box > shade) { } /* Message 1424 */
if (box <= shade) { } /* Message 1424 */
return;
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |