Help with bit-field semantics in C and C++
D. Starner
shalesller@writeme.com
Fri Aug 27 21:50:00 GMT 2004
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
More information about the Gcc
mailing list