[PATCH] BIT_FIELD_REF_UNSIGNED considered harmful

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Wed Mar 5 14:27:00 GMT 2008


> > >+ 	      if (INTEGRAL_TYPE_P (TREE_TYPE (t))
> > >+ 		  && (TYPE_PRECISION (TREE_TYPE (t))
> > >+ 		      != TREE_INT_CST_LOW (TREE_OPERAND (t, 1))))
> > >+ 		{
> > >+ 		  error ("integral result type precision does not match "
> > >+ 			 "field size of BIT_FIELD_REF");
> > >+ 		  return t;
> > >+ 		}
> > >+ 	      if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
> > 
> > 'else if' here?
> 
> In theory, yes, but, why? 

It's easier to read at-a-glance.  A reader can tell quickly that the 
intent is that only one of the options be taken.  It's easier to spot
the "else" than the "return" in the body.



More information about the Gcc mailing list