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

Steven L. Zook SLZook@Qualstar.com
Fri Aug 27 22:13:00 GMT 2004


I'm asking whether the initialized value for Sparse would be 0xF, or one of One, Two, Four, or Eight.

This isn't a trick question, I'm just checking if I've caught the correct conclusion of this discussion.

-----Original Message-----
From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org]On Behalf Of
Gabriel Dos Reis
Sent: Friday, August 27, 2004 2:55 PM
To: Steven L. Zook
Cc: GCC Mailing List (E-mail)
Subject: Re: Help with bit-field semantics in C and C++


"Steven L. Zook" <SLZook@Qualstar.com> writes:

| What would happen in this case?
| 
| enum eSparse { One = 1, Two = 2, Four = 4, Eight = 8 };
| eSpare Sparse = ( eSparse )0x0FFFF;

I guess I don't understand your question.  The smallest bit-field that
can represent One and Eight is 4 bits wide.  Right?

-- Gaby



More information about the Gcc mailing list