This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lto] RFC: How should gimple represent enums?


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
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]