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: David Carlton <david dot carlton at sun dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: Mike Stump <mrs at apple dot com>, Joe Buck <Joe dot Buck at synopsys dot COM>, Roger Sayle <roger at eyesopen dot com>, Mark Mitchell <mark at codesourcery dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 24 Aug 2004 13:22:40 -0700
- Subject: Re: Help with bit-field semantics in C and C++
- References: <A2B3C6B0-F607-11D8-AF5A-003065BDF310@apple.com><m3vff8jnw8.fsf@uniton.integrable-solutions.net>
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