|
|
|
|
|
by barrkel
2718 days ago
|
|
C enum values are convertible from int; C++ enum values aren't. This is one of the biggest differences in fairly idiomatic C code and has been the case for a very long time (i.e. not dependent on newer C features not being in C++). #include <stdio.h>
typedef enum EFoo {
FOO_A = 1,
FOO_B = 2
} TFoo;
int main()
{
TFoo foo = FOO_A | FOO_B;
printf("foo = %d\n", foo);
}
This compiles in C but not C++. |
|