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

Joseph S. Myers jsm@polyomino.org.uk
Tue Aug 24 23:45:00 GMT 2004


On Tue, 24 Aug 2004, Roger Sayle wrote:

> My apologies.  Joseph Myers and Mark Mitchell have already pointed
> out the I've used the wrong terminology.  The g++ front-end treats
> C++ enumerators as "bit-sized" integers.  These are not the same
> to language lawyers as bit-fields.  In the middle-end, however, they
> are treated similarly.

Note that the middle-end handling of bit-field types is restricted by a 
langhook and is only applied to integer types.  This is not entirely 
ideal, but was done as a pragmatic solution to get in a solution to 
long-standing much-reported C bugs in a finite time without adversely 
affecting other languages, since only C and ObjC deliberately use these 
types with their semantics and trees aren't *yet* precisely enough defined 
in this regard: other languages may generate types with narrower precision 
and mode without expecting the special handling (as possibly with C++ 
enums under discussion at present).  In future it may be possible to 
define trees more precisely so that what these types mean is clear in all 
circumstances, and remove the reduce_bit_field_operations langhook.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc mailing list