Re: Prohibit enum <-> int mixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
> Enrico Weigelt <weigelt@xxxxxxxx> 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.

I'm using C++. It already warns me about a few things, eg. missing
case's in switch statements. But it still accepts assigning 
enum to int and vice versa.


cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weigelt@xxxxxxxx
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux