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

Mike Stump mrs@apple.com
Tue Aug 24 23:22:00 GMT 2004


On Tuesday, August 24, 2004, at 02:42  PM, David Carlton wrote:
> Just to clarify: I agree that, it's okay if, on one run of the
> program, the program behaves as if it's 0 and on another run of the
> program, the program behaves as if it's 1, or other similar
> pathologies.  But I don't see how the standard allows the program to
> behave as if the value is neither 0 nor 1.

(E)n, where n is an int with value, say of 7, is permitted by the 
standard to take on the value 7.  This is because the text of the 
standard says the value is unspecified.  7 is a unspecified value, 
honest.

the assignment to x of (E)n, is permitted to bit-wise copy the value 
into x.



More information about the Gcc mailing list