Re: [webkit-dev] style question for empty for loops
On Thu, Aug 26, 2010 at 1:12 PM, Chris Fleizach wrote: > webkit-check-style should probably be amended as well > Please file a bug. Feel free to cc ham...@chromium.org, le...@chromium.org, cjerdo...@webkit.org > > > On Aug 26, 2010, at 12:48 PM, James Robinson wrote: > > The style guide currently covers this > http://webkit.org/coding/coding-style.html: > > 4. Control clauses without a body should use empty braces: Right: > > for ( ; current; current = current->next) { } > > Wrong: > > for ( ; current; current = current->next); > > > - James > > On Thu, Aug 26, 2010 at 12:22 PM, Chris Fleizach wrote: > >> >> On 26. aug. 2010, at 11.49, Darin Adler wrote: >> >> > On Aug 26, 2010, at 11:35 AM, Chris Fleizach wrote: >> > >> >>for (...; ...; ...) { } >> > >> >> So maybe this is the best option. I can add a style guide check for that, >> unless there are objections >> >> ___ >> webkit-dev mailing list >> webkit-dev@lists.webkit.org >> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev >> > > > > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > > ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] style question for empty for loops
webkit-check-style should probably be amended as well On Aug 26, 2010, at 12:48 PM, James Robinson wrote: > The style guide currently covers this > http://webkit.org/coding/coding-style.html: > > 4. Control clauses without a body should use empty braces: > Right: > for ( ; current; current = current->next) { } > Wrong: > for ( ; current; current = current->next); > > - James > > On Thu, Aug 26, 2010 at 12:22 PM, Chris Fleizach wrote: > > On 26. aug. 2010, at 11.49, Darin Adler wrote: > > > On Aug 26, 2010, at 11:35 AM, Chris Fleizach wrote: > > > >>for (...; ...; ...) { } > > > > So maybe this is the best option. I can add a style guide check for that, > unless there are objections > > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] style question for empty for loops
The style guide currently covers this http://webkit.org/coding/coding-style.html: 4. Control clauses without a body should use empty braces:Right: for ( ; current; current = current->next) { } Wrong: for ( ; current; current = current->next); - James On Thu, Aug 26, 2010 at 12:22 PM, Chris Fleizach wrote: > > On 26. aug. 2010, at 11.49, Darin Adler wrote: > > > On Aug 26, 2010, at 11:35 AM, Chris Fleizach wrote: > > > >>for (...; ...; ...) { } > > > > So maybe this is the best option. I can add a style guide check for that, > unless there are objections > > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] style question for empty for loops
On 26. aug. 2010, at 11.49, Darin Adler wrote: > On Aug 26, 2010, at 11:35 AM, Chris Fleizach wrote: > >>for (...; ...; ...) { } > So maybe this is the best option. I can add a style guide check for that, unless there are objections ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] style question for empty for loops
On Aug 26, 2010, at 12:11 PM, Nico Weber wrote: > FWIW, clang warns about (C) but doesn't warn about the others (at least on > high warning levels). Seems like a good reason not to use (C). -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] style question for empty for loops
On Thu, Aug 26, 2010 at 11:49 AM, Darin Adler wrote: > On Aug 26, 2010, at 11:35 AM, Chris Fleizach wrote: > >> for (...; ...; ...) { } > > This seems OK. > >> for (...; ...; ...) >> { } > > The above is definitely not allowed, because braces go on the line with the > "for". > > The other possibilities are: > > C) > for (...) > ; > > D) > for (...) { > } > > E) > for (...) { > // intentionally-empty loop body. > } > > I would probably use (C) in code I was writing. This doesn’t come up much. FWIW, clang warns about (C) but doesn't warn about the others (at least on high warning levels). Nico > > -- Darin > > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] style question for empty for loops
On Aug 26, 2010, at 11:35 AM, Chris Fleizach wrote: > for (...; ...; ...) { } This seems OK. > for (...; ...; ...) > { } The above is definitely not allowed, because braces go on the line with the "for". The other possibilities are: C) for (...) ; D) for (...) { } E) for (...) { // intentionally-empty loop body. } I would probably use (C) in code I was writing. This doesn’t come up much. -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] style question for empty for loops
Option 1 Seems in keeping with what is done for constructors/functions w/o bodies, so for consistency, I think it it preferable. On Thu, Aug 26, 2010 at 11:35 AM, Chris Fleizach wrote: > Which is preferred? > > for (...; ...; ...) { } > > or > > for (...; ...; ...) > { } > > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > > ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
[webkit-dev] style question for empty for loops
Which is preferred? for (...; ...; ...) { } or for (...; ...; ...) { }___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev