I have some code I\'m porting to a new platform, and it started giving me an error about comparing two enumerators from two different enumerator-lists. I\'m confused why it\'s g
It's warning you because you have the warning flag on. The flag description doesn't explain why it exists, but it's probably safe to assume that it exists to prevent accidental comparisons between different enumeration types, because this usually is an error.
Furthermore, you are correct that you can use enumeration values the same as you can int constants. And if you said if (myf == c)
then it most likely wouldn't have thrown a warning (I say most likely because I haven't experimented, and GCC honestly can do whatever it wants with that warning, but technically c
is just an integral constant and does not carry the type enum second
). But instead you're explicitly comparing two values of different enumeration types.