[previous] 1480 [next] Objects or constants of different enum types are operands of a bitwise operator.
Arithmetic type - Enum types REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers

Two objects or constants of different enum types are the operands of a bitwise operator. Is this intended ?

For example:


/*PRQA S 2017,2211,2213,3198,3199,3203,3227,3408,3447,3448,3602 ++*/

typedef enum SIZE   { SMALL, MEDIUM, LARGE }     TSIZE;
typedef enum COLOUR { RED, GREEN, BLUE, YELLOW } TCOLOUR;

extern TCOLOUR paper;

extern void test(TSIZE box)
{
    TSIZE r;

    r = paper & box;                    /* Message 1480 */
    r = paper | MEDIUM;                 /* Message 1480 */
    r = GREEN ^ MEDIUM;                 /* Message 1480 */

    return;
}

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