typeof and bitfields

Mark Mitchell mark@codesourcery.com
Tue Jan 18 11:22:00 GMT 2005


Gabriel Dos Reis wrote:
> Alexandre Oliva <aoliva@redhat.com> writes:
> 
> | On Jan 14, 2005, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
> | 
> | > That is an argument for not returning an int.  It is not an argument
> | > for issueing error.  Why not return int_with_2bits?
> | 
> | Let's see...

I'm supportive of Joseph's patch.

The submitter in PR10333 clearly thought that you should get an 
int_with_2bits type.  Matt suggested that you should just get "int". 
Ian suggested "char".  I see good arguments for all of the choices.  So, 
there are no obvious semantics.  Why define an extension that the 
average user has only a 1/3 chance of understanding?

There's only one good reason, and Matt has already given it: backwards 
compatibility.  Fortunately, that compatibility is only with a GNU 
extension used in a pretty obscure way, and there is an easy workaround 
(don't use typeof; use the type of the bitfield instead) that will work 
in most cases.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304



More information about the Gcc mailing list