This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]