This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Prohibit enum <-> int mixup
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 29 Jan 2011 10:40:20 -0800
- Subject: Re: Prohibit enum <-> int mixup
- References: <20110129164124.GA27641@nibiru.local>
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