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, Mar 12, 2009 at 13:08, Joseph S. Myers <joseph@codesourcery.com> wrote:
> 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++.

Thanks.  I think this settles it then.


Diego.


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