[webkit-dev] style question for empty for loops

Nico Weber thakis at chromium.org
Thu Aug 26 12:11:12 PDT 2010


On Thu, Aug 26, 2010 at 11:49 AM, Darin Adler <darin at apple.com> 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 at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>


More information about the webkit-dev mailing list