Help with bit-field semantics in C and C++

Gabriel Dos Reis gdr@integrable-solutions.net
Fri Aug 27 05:18:00 GMT 2004


Mike Stump <mrs@apple.com> writes:

| On Aug 26, 2004, at 6:26 PM, Gabriel Dos Reis wrote:
| > After exchange on the core reflector, John Spicer came to the
| > agreement that it is the enumeration value that is unspecified.
| 
| 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.

| We can do that.  Wanna ask Tom to put this in his testsuite, so that
| we can get all the other C++ compilers to switch?

OK.

Thanks,

-- Gaby



More information about the Gcc mailing list