Help with bit-field semantics in C and C++
David Carlton
david.carlton@sun.com
Tue Aug 24 20:55:00 GMT 2004
On Tue, 24 Aug 2004 22:12:55 +0200, Gabriel Dos Reis <gdr@integrable-solutions.net> said:
> The bits of the standard text the most relevant to Roger's question are
> http://gcc.gnu.org/ml/gcc/2004-08/msg01167.html
> Those say that the sequence of statements
> enum E x;
> x = (E)n;
> store an unspecified value in the location designated by x.
An unspecified enumeration value, specifically, by 7.2/9. Where
"enumeration value" is presumably defined by 7.2/6.
> It may be 0 or 1 or whatever fits, it does not matter.
It seems to me that the program has to behave as if it's 0 or 1: in
Roger's example, it's unspecified whether it should call foo() or
bar(), but it shouldn't core dump.
David Carlton
david.carlton@sun.com
More information about the Gcc
mailing list