This is the mail archive of the
mailing list for the GCC project.
Re: [gcc-in-cxx] Revert adding newlines for semicolon in loops
- From: Ian Lance Taylor <iant at google dot com>
- To: tromey at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 24 May 2009 20:37:55 -0700
- Subject: Re: [gcc-in-cxx] Revert adding newlines for semicolon in loops
- References: <email@example.com> <firstname.lastname@example.org>
Tom Tromey <email@example.com> writes:
>>>>>> "Ian" == Ian Lance Taylor <firstname.lastname@example.org> 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.