[previous] 0589 [next] [C] Enumeration constant must be an integral constant expression.
Constraint violations REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers - Constraints

This is a constraint error

The expression used to specify the value of this enumeration constant is not an integral constant expression.

For example:


/*PRQA S 553,722,723,1269,3602 ++*/

#define MAX 3.2f
#define X (int)MAX
#define Y (int)(1.9f * MAX)

enum colours
{
    RED = X,
    YELLOW = Y,          /* Message 0589 */
    GREEN,
    BLUE
};

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