On Thu, 12 Mar 2009, Diego Novillo wrote: > Since C treats enums as ints, the maximum value is always INT_MAX > regardless of how many values are declared. So the question is, how > should we lower enums into gimple? > > The temptation is to use C++'s limits, but I'm concerned that may > produce confusion somewhere down the line with the optimizers or other > diagnostics. Or should we use C's notion and treat them as ints?
In C an enum type is always compatible with and represented the same as some integer type, so using C++ limits could result in miscompilation of C code using enums; if int is the type chosen, a variable of the enum type may legitimately hold any value of type int, unlike in C++. -- Joseph S. Myers jos...@codesourcery.com