This diagnostic rule is based on the software development guidelines developed by MISRA (Motor Industry Software Reliability Association).
This diagnostic rule is relevant only to C++ programs. The analyzer has detected an enumeration whose members are initialized in a mixed way (explicitly and implicitly). This may result in duplicating their values.
Here is an example of incorrect code:
enum Suits { SUITS_SPADES = 1, SUITS_CLUBS, SUITS_DIAMONDS, SUITS_HEARTS, SUITS_UNKNOWN = 4 };
The way the elements are initialized here results in assigning the same value to the members 'SUITS_HEARTS' and 'SUITS_UNKNOWN'. It is not clear if this was done on purpose or by mistake.
The warning is not issued in the following cases:
This diagnostic is classified as:
|