C51: V7.50 When I try to build the following code, I receive Warning C259, complaining about enumeration types : typedef enum { ZERO, ONE, TWO } Numbers; void main(void) { Numbers e_numbers; e_numbers = (Numbers) ( ZERO |ONE |TWO ); }
ZERO | ONE | TWO produces the value 3 decimal, which is not a defined member of the enumeration. The warning message is obscure, but the compiler is trying to tell you that you are assigning a constant value not defined as part of your enumeration. One fix is
typedef enum { ZERO, ONE, TWO, THREE } Numbers;
"Is it really a meaningful operation to OR members of this enum together?" eg, are you confusing this with a Pascal set...?