Coding style: do_this(a,b) vs. do_this(a, b)
Quoted 3 lines
Coding style document is not consistent with
itself on whether there should be space after
","... This makes it standartize on ", " option.
You can read it both ways, right? It's easy. I can't even see the difference unless I'm looking for it.
We don't need any more bureaucracy.
do_this(a,b);do_this(a, b);do_this (a,b);do_this (a, b);
I can read them all. I might notice the space in front of the '(', but I might not. Even putting a space in front of the ';' isn't unreadable.
People will pass laws until they are choked off, unable to move without being in violation of some silly little thing.
Quoted 15 lines · Albert Cahalan
Quoted 3 lines
Coding style document is not consistent with
itself on whether there should be space after
","... This makes it standartize on ", " option.You can read it both ways, right? It's easy. I can't even see the difference unless I'm looking for it.
We don't need any more bureaucracy.
do_this(a,b);do_this(a, b);do_this(a,b);do_this(a, b);
Quoted 7 lines
I can read them all. I might notice the space in front of the '(', but I might not. Even putting a space in front of the ';' isn't unreadable.
People will pass laws until they are choked off, unable to move without being in violation of some silly little thing.
Some of us do see it and find it very annoying, I'm one of those who very much prefer do_this(a, b) and especially when there are more than two parameters.
One of the reasons I do like linux is the coding standard, I find many other projects completely unreadable.
Hi!
Quoted 7 lines
Quoted 3 lines
Coding style document is not consistent with
itself on whether there should be space after
","... This makes it standartize on ", " option.You can read it both ways, right? It's easy. I can't even see the difference unless I'm looking for it.
Well, you maybe can't tell the difference, but I definitely can. You can read code aligned by two spaces, right?
Quoted 5 lines
We don't need any more bureaucracy.
do_this(a,b); (1)do_this(a, b); (2)do_this(a,b);
This looks extremely bad.
Quoted 9 lines
do_this(a, b);I can read them all. I might notice the space in front of the '(', but I might not. Even putting a space in front of the ';' isn't unreadable.
People will pass laws until they are choked off, unable to move without being in violation of some silly little thing.
I've seen people "fixing" code from (2) to (1), because they thought I prefer (1). (And I definitely don't). So yes, it is important.
Pavel
Signature · 2 lines
People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
Quoted 6 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 3 lines
Coding style document is not consistent with
itself on whether there should be space after
","... This makes it standartize on ", " option.
Quoted 6 lines
Quoted 3 lines
You can read it both ways, right? It's easy. I can't even see the difference unless I'm looking for it.
Well, you maybe can't tell the difference, but I definitely can. You can read code aligned by two spaces, right?
Sure, but you can't mix that in the same file with something else. Indentation and braces have to be consistent. Other stuff matters far less.
Quoted 14 lines
Quoted 5 lines
We don't need any more bureaucracy.
do_this(a,b); (1)do_this(a, b); (2)do_this(a,b);This looks extremely bad.
Quoted 6 lines
do_this(a, b);I can read them all. I might notice the space in front of the '(', but I might not. Even putting a space in front of the ';' isn't unreadable.
Quoted 6 lines
Quoted 3 lines
People will pass laws until they are choked off, unable to move without being in violation of some silly little thing.
I've seen people "fixing" code from (2) to (1), because they thought I prefer (1). (And I definitely don't). So yes, it is important.
Spaces are good for grouping things to increase readability. So one might do this:
foo(a,b,c,d,e,f);bar(a+b, a-b); // space needed for readabilitybaz(a,b, c,d); // suppose a and b logically go together, as do c and dzzz(a==b && c==d); // common for an "if"
Slapping some arbitrary rule on top of this would prohibit attempts to make things more readable. Consider alignment between various lines when calling similar functions:
foo(a, b+c, *q, *p);bar(a, b+c, another, *q, *p);baz(a, b, another, *q );
Sometimes it helps to see things neatly lined up like that. Sometimes not, of course. The author needs freedom to lay things out nicely when it matters, while not concerning himself with trivial spacing differences when it doesn't matter.
Hi!
Quoted 6 lines
Quoted 2 lines
Well, you maybe can't tell the difference, but I definitely can. You can read code aligned by two spaces, right?
Sure, but you can't mix that in the same file with something else. Indentation and braces have to be consistent. Other stuff matters far less.
This kind of spacing matters, too.
Quoted 18 lines
Quoted 18 lines
Quoted 5 lines
We don't need any more bureaucracy.
do_this(a,b); (1)do_this(a, b); (2)do_this(a,b);This looks extremely bad.
Quoted 9 lines
do_this(a, b);I can read them all. I might notice the space in front of the '(', but I might not. Even putting a space in front of the ';' isn't unreadable.
People will pass laws until they are choked off, unable to move without being in violation of some silly little thing.
Quoted 7 lines
Quoted 2 lines
I've seen people "fixing" code from (2) to (1), because they thought I prefer (1). (And I definitely don't). So yes, it is important.
Spaces are good for grouping things to increase readability. So one might do this:
foo(a,b,c,d,e,f);
This looks ugly.
Quoted 3 lines
bar(a+b, a-b); // space needed for readabilitybaz(a,b, c,d); // suppose a and b logically go together, as do c and dzzz(a==b && c==d); // common for an "if"
Would be okay. Notice that I did not add a rule, I just fixed the examples to be consistent with each other.
Anyway, as in common english, there should be space after ",". There may be exception to the rule (your baz example), but...
Here's the patch again. macrofun() is used as an example, but it looks ugly, and is not consistent with the rest of the document.
Pavel
Documentation/CodingStyle +3 -3
@@ -356,11 +356,11 @@ Macros with multiple statements should be enclosed in a do - while block: -#define macrofun(a,b,c) \ +#define macrofun(a, b, c) \ do { \ if (a == 5) \ - do_this(b,c); \ - } while (0) + do_this(b, c); \ + } while(0) Things to avoid when using macros:
Signature · 2 lines
People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!