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


Tom Tromey <tromey@redhat.com> writes:

>>>>>> "Ian" == Ian Lance Taylor <iant@google.com> writes:
>
> Ian> g++ no longer warns about an empty loop with no whitespace between the
> Ian> loop statement and the semicolon.  I committed this patch to the
> Ian> gcc-in-cxx branch to revert cases where a newline had been added to
> Ian> avoid the g++ warning.
>
> 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
the gcc-in-cxx branch when they are unrelated to the purpose of the
branch.  If anybody wants to pick up this patch and test it on mainline,
I'll approve it.

Ian


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