[previous] 0723 [next] Initialize none, first only, or all entries in this enumerator list.
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 0723 is generated when an enumeration does not conform to any of the following principles:

For example:


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

enum A {A1 = 5, A2, A3, A4};

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

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

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

enum E {E1 = 5, E2 = 7, E3 = 9, E4};            /* Message 0723 */


MISRA-C:2004 Rules applicable to message 0723:

Rule  9.3  (Required) In an enumerator list, the '=' construct shall not be used to explicitly initialise members other than the first, unless all items are explicitly initialised.


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