WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
27499
Coding style - Clarify some cases with spacing
https://bugs.webkit.org/show_bug.cgi?id=27499
Summary
Coding style - Clarify some cases with spacing
Luciano Wolf
Reported
2009-07-21 07:40:39 PDT
Clarify the case where there is spacing before a comma/semicolon in a control condition and in functions. I would like for it to be clear if the following is wrong or right according to the coding style. for (int i = 0 ; i < 10 ; i++) doSomething(); // Qt's foreach foreach (QString &item , items) doSomething(); f(a , b);
Attachments
Add explicit rule about no space before comma or semicolon
(2.03 KB, patch)
2009-07-22 05:39 PDT
,
Kenneth Rohde Christiansen
manyoso
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Kenneth Rohde Christiansen
Comment 1
2009-07-21 15:39:28 PDT
Personally I would vote for this being discouraged by the coding style, and I have personally yet to find such code in the webkit project. What is your guys take on this?
David Levin
Comment 2
2009-07-21 15:49:20 PDT
Putting no spaces before ; and , is basically following the current project style even though it isn't in the style guide. I would likely mention it in a review.
Kenneth Rohde Christiansen
Comment 3
2009-07-21 15:52:19 PDT
So you think it would be OK to make a patch for the coding style guidelines? If so, I can do that.
David Levin
Comment 4
2009-07-21 15:57:07 PDT
Maybe just ask if this the current style on webkit-dev before and mention that you're willing to creating a style guide patch. That's how I saw it happen when someone else added something to the guide. This way everyone has a chance to see the style guide change. (They may not see the patch being submitted).
Kenneth Rohde Christiansen
Comment 5
2009-07-21 16:06:26 PDT
I agree and have send an e-mail to the discussion list.
Kenneth Rohde Christiansen
Comment 6
2009-07-22 05:32:38 PDT
From the mailing list: I believe it is quite well established that a space should not be allowed before a ; or , in such circumstances. (I have r-ed for it even ;) ). I think we should definitely explicitly call this out in the guidelines if it is not already. -Sam The examples in the coding style guidelines use the right style (i.e. no space before the comma or semicolon), it would be fine to make it an explicit rule. - Maciej Patch coming up!
Kenneth Rohde Christiansen
Comment 7
2009-07-22 05:39:31 PDT
Created
attachment 33257
[details]
Add explicit rule about no space before comma or semicolon
Adam Treat
Comment 8
2009-07-22 05:54:07 PDT
Comment on
attachment 33257
[details]
Add explicit rule about no space before comma or semicolon Please take out the foreach examples as that's likely to confuse people not familiar with Qt :) Otherwise, r+ following discussions on webkit-dev.
Kenneth Rohde Christiansen
Comment 9
2009-07-22 06:04:59 PDT
Landed in
r46219
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug