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: Help with bit-field semantics in C and C++


Gabriel Dos Reis <gdr at integrable-solutions dot net> writes:
> Mike Stump <mrs@apple.com> writes:
> | So
> |
> | e = (E)7;
> | 
> | printf ("%d\n", (int)e));
> | 
> | should print 3, and not 7 as is does now, and this should work by
> | converting integer types into enumeration types, and not by masking
> | upon converting enumeration types to ints?  Did I get that right?
>
> Yes, the masking happens when converting from integer to enumeration,
> not from enumeration to integer.

Shouldn't gcc offer a warning on cases where an out-of-range constant
is assigned to a literal, then? Especially as the correct behavior
was under dispute by people knowledgable in C.
-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


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