This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Speed up genattrtab


Richard Earnshaw wrote:

>>> +	  else
>>> +	    {
>>> +	      for (av = attr->first_value; av; av = av->next)
>>> +		for (ie = av->first_insn; ie; ie = ie->next)
>>> +		  if (ie->def->insn_code == insn_code)
>>> +		    goto got_av;
>>> +	    }
>> Style nit: there should be no braces here, since there is a single
>> dependent statement.
> 
> I disagree.  The for loops contain an un-braced 'if' statement.
> Consider someone making the change to make the first else an 'else if'
> and then tacking on a further else clause...

I agree that the original version is more robust against future change.
 In my own code, I always write "if (...) { ... }" even if there's only
one dependent statement.  But, I thought that the GNU coding standards
left no room for interpretation in this case.  If everyone's comfortable
with making an exception for this case, it's fine by me.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]