[previous] 1400 [next] Enum object is being compared with an enum constant of a different enum type using an equality operator.
Arithmetic type - Enum types REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers

An enum object is being compared with an enum constant from a different enumeration using an equality operator. Is this intended ?

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 1400, 1317 --*/

enum SIZE   { SMALL = 1, MEDIUM = 2, LARGE = 3 };
enum COLOUR { RED = 2, GREEN = 4, BLUE = 6 };

extern void foo(enum SIZE box)
{
   if (box == RED  ) { }        /* Message 1400        */
   if (box != GREEN) { }        /* Message 1400 + 1317 */

   return;
}

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents