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

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Aug 25 01:40:00 GMT 2004


Joe Buck <Joe.Buck@synopsys.COM> writes:

| On Wed, Aug 25, 2004 at 02:24:19AM +0200, Gabriel Dos Reis wrote:
| > I believe the issue is whether the value actually stored in the enum
| > object should be 7. That is where I was understanding "permitted"
| > being used.
| 
| All compilers from GNU, Sun, and HP appear to happily store the 7.

The compatibility annexe (D) of the C++ standards documents that

  C++ objects of enumeration type can only be assigned values of the
  same enumeration type. In C, objects of enumeration type can be
  assigned values of any integral type 

  Effect on original feature: Deletion of semantically well-defined
  feature. 
  Difficulty of converting: Syntactic transformation. (The type error
  produced by the assignment can be automatically corrected by
  applying an explicit cast.) 
  How widely used: Common.

I don't have my copy of ARM handy here to check for more elaboration.

-- Gaby



More information about the Gcc mailing list