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: [gcc-in-cxx] Revert adding newlines for semicolon in loops


On Sun, May 24, 2009 at 11:37 PM, Ian Lance Taylor <iant@google.com> wrote:
> Tom Tromey <tromey@redhat.com> writes:
>
>>>>>>> "Ian" == Ian Lance Taylor <iant@google.com> writes:
>> Ian> - ? ? ? ?for (n = 0, e = rdg->vertices[i].succ; e; e = e->succ_next, n++)
>> Ian> - ? ? ? ? ?;
>> Ian> + ? ? ? ?for (n = 0, e = rdg->vertices[i].succ; e; e = e->succ_next, n++);
>>
>> FWIW, I find the variant with the newline much more readable.
>> The trailing semicolon is too easy to overlook.
>> How about leaving the newline and declaring this the GCC style?
>
> I agree that the newline is more readable, and I agree that it is bad
> style to not have a newline. ?I just didn't want to keep the diffs on

Why not just do:

for (n = 0, e = rdg->vertices[i].succ; e; n++)
  e = e->succ_next;

?

With all the talk about readability, it seems people are overlooking
how much you have to disect the for statement to find out what the
loop does.  The actual action should be placed in the body of the loop
for readabilitiy, not cramed into the for statement.  The talk about a
semicolon seems, to me, to pale in comparison for "readability" sake.


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