This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [gcc-as-cxx] enum conversion to int
Matt <matt@use.net> writes:
> On Tue, 5 Jan 2010, Ian Lance Taylor wrote:
>
>> Matt <matt@use.net> writes:
>>
>>> Yes, was I pasted was a local change. I was trying to eliminate the
>>> implicit cast to int from the enum type, which was causing my
>>> --enable-werror build to fail. At this point, I think the better
>>> option would be to break up the enum values into indivdual #defines
>>> and do a typedef df_changeable_flags int;
>>
>> Don't use #defines. Enums give better debug info by default. typedef
>> df_changeable_flags int is fine if that seems necessary. Right now
>> the code simply doesn't use the df_changeable_flags type any time
>> there is more than one flag.
>
> Okay, good to know about the better debuggability of enums. If the
> flags are supposed to be mutually exclusive, then the code in my other
> email where two flags are added together seems contrary.
The flags are not mutually exclusive. They are bit values which may
be combined. This is a pattern which is used in various places in
gcc.
> Regardless, does this mean that the bit-wise operations for set_flags
> and clear_flags could be changed to simple assignments? That would
> indeed fix this issue in a nice way.
No, that won't work.
What is the actual problem that you are encountering?
Ian