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: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: "Steven L. Zook" <SLZook at Qualstar dot com>
- Cc: "GCC Mailing List (E-mail)" <gcc at gcc dot gnu dot org>
- Date: 28 Aug 2004 00:19:11 +0200
- Subject: Re: Help with bit-field semantics in C and C++
- Organization: Integrable Solutions
- References: <9E27B4AB55478346B9F7848926E49B7F4F6FD2@exchange1.qualstar.com>
"Steven L. Zook" <SLZook@Qualstar.com> writes:
| Ok, it sounds like I wasn't tracking the discussion quite right
| (which is what I was trying to ascertain). By "enumeration value" it
| sounds like what you mean is a numerical representation that fits in
| the minimum bit width of the type (in my example case 4 bits in
| width and so any of 16 values would qualify, thus a masking
| operation can always bring any integer value into range).
That is what the Standard C++ says, 7.2/6:
For an enumeration where emin is the smallest enumerator and emax is
the largest, the values of the enumeration are the values of the
underlying type in the range bmin to bmax, where bmin and bmax are,
respectively, the smallest and largest values of the smallest
bit-field that can store emin and emax.81) It is possible to define
an enumeration that has values not defined by any of its
enumerators.
-- Gaby