We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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...?