[previous] 0722 [next] Enum constant not explicitly initialized, but a previous constant has been.
Enumerations REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers - Semantics

If an enumeration constant is not explicitly initialized, its value is determined by adding 1 to the value of the previous constant. If the first enumeration constant is not explicitly initialized, its value is 0.

Message 0722 is generated when an enumeration constant is not explicitly initialized but a previous constant has been.

For example:


/*PRQA S 553,723,2017,2211,2213,3602 ++*/

enum A {A1, A2, A3 = 10, A4 = 12};

enum B {B1 = 3, B2 = 5, B3 = 7, B4 = 9};

enum C {C1, C2, C3, C4};

enum D {D1, D2 = 5, D3, D4 = 10};               /* Message 0722 */

enum E {E1, E2, E3 = 10, E4};                   /* Message 0722 */


No MISRA-C:2004 Rules applicable to message 0722


See also:

QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents