On 29 January 2011 22:33, Jonathan Wakely wrote: > On 29 January 2011 20:48, Enrico Weigelt wrote: >> >> 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. > > No it doesn't, C++ allows enums to be assigned to ints but not the > other way around. > > enum e { val }; > e var = 0; > > e.cc:2: error: invalid conversion from ‘int’ to ‘e’ Technically what is allowed is implicit conversion from enum to int. In C++0x you can define a scoped enum which doesn't allow the conversion.