Prohibit enum <-> int mixup
Ian Lance Taylor
iant@google.com
Sat Jan 29 20:58:00 GMT 2011
Enrico Weigelt <weigelt@metux.de> writes:
> is there a way to let the compiler prohibit mixing up enums and
> ints ? (eg. no assignments between enums and ints, no numeric
> operations on enums, etc).
I assume you are talking about C. Try -Wc++-compat. However, that will
warn about a number of things other than enum comparisons. There is no
option to pull out the specific enum checks from the rest of the C++
compatibility checks.
Ian
More information about the Gcc-help
mailing list