This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Help with bit-field semantics in C and C++
- From: "D. Starner" <shalesller at writeme dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 27 Aug 2004 13:26:42 -0800
- Subject: 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