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: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Geoffrey Keating <geoffk at geoffk dot org>, gcc at gcc dot gnu dot org
- Date: Tue, 24 Aug 2004 23:26:58 +0000 (UTC)
- Subject: Re: Help with bit-field semantics in C and C++
- References: <Pine.LNX.4.44.0408241513080.14511-100000@www.eyesopen.com>
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)