TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Rule:  6.7.2.2.aChecked automatically with code checker

Synopsis:Mixing of different enum types is not allowed.
Language:C
Severity Level:4
Category:Declarations


Description:

Justification

This is considered bad practice and can also result in unexpected behavior.

Example

enum Animal { CAT, DOG, PIG, HORSE };
enum Color  { BLACK, RED, YELLOW };

Animal eAnimal = RED; /* WRONG */

Note

The C++ language already contains enumerated types as distinct types. Consequently, trying to assign enumerators from one enum type to another enum type will cause a C++ compiler error.