[webkit-dev] Coding style

David Levin levin at google.com
Thu Jun 4 11:28:34 PDT 2009


I've thought rule of the rule as this
"Control clauses (including any preceeding comments) that are one* physical
*line should not use braces".
So something like

if (test) {
myFunction(reallyLongParam1, reallyLongParam2, ...
reallyLongParam4);
}

would also have braces.

Is that how others interpret it?

Dave

On Thu, Jun 4, 2009 at 9:50 AM, Kenneth Christiansen <
kenneth.christiansen at openbossa.org> wrote:

> OK, done! :-)
>
> https://bugs.webkit.org/show_bug.cgi?id=26188
>
> Cheers,
> Kenneth
>
> On Thu, Jun 4, 2009 at 12:13 PM, David Kilzer <ddkilzer at webkit.org> wrote:
> > Hi Kenneth,
> > The examples you give below are correct (with the exception of the number
> of
> > spaces used to indent the code in the else blocks).
> > Please file a bug on bugs.webkit.org and attach a patch.  The webkit.orgweb
> > site is in the svn repository, so you may create patches against the
> HTML.
> > Thanks!
> > Dave
> >
> > ________________________________
> > From: Kenneth Christiansen <kenneth.christiansen at openbossa.org>
> > To: webkit-dev <webkit-dev at lists.webkit.org>
> > Sent: Thursday, June 4, 2009 7:52:29 AM
> > Subject: [webkit-dev] Coding style
> >
> > Hi there,
> >
> > I'm having a question regarding the coding style.
> >
> > According to 2. An else statement should go on the same line as a
> > preceding close brace.
> >
> > I would always need a brace when using if-else, in order to but the
> > else statement on the same line as the preceding close brace, is this
> > right?
> > or would something like this is OK:
> >
> > if (condition)
> >     func1();
> > else
> >   func2();
> >
> > And what about this case
> >
> > if (condition)
> >     func1();
> > else {
> >   func2();
> >   func3();
> > }
> >
> > It would be nice to have this defined in the coding style,  as well as
> > adding the case that when you have a comment inside a one line if
> > statement you will need braces, like
> >
> > if (condition) {
> >     // comment
> >     func()
> > }
> >
> > Cheers, Kenneth
> > _______________________________________________
> > webkit-dev mailing list
> > webkit-dev at lists.webkit.org
> > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> >
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090604/88b2eb48/attachment.html>


More information about the webkit-dev mailing list