|
zergstain posted:Everyone uses vi/vim. I'm sure if we used an IDE, people would just configure the indenting the way they like and we'd still have the same problem. And I know vim can take care of it, but good luck pushing everybody to use the same config. And now you have also revealed that your team is using CVS
|
# ? Jul 9, 2013 05:56 |
|
|
# ? Jun 1, 2024 05:11 |
|
Deus Rex posted:fix that opening brace and it is perfect Yeah, why put a space between the `else` and the `{` and not between the `if` and the `{`? I imagine that's a typo. Unless you were talking about putting the opening brace on the next line. In which case, gently caress you.
|
# ? Jul 9, 2013 06:36 |
|
http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py
|
# ? Jul 9, 2013 06:56 |
|
Merely pointing out an annoying coding style.
|
# ? Jul 9, 2013 07:09 |
|
Strong Sauce posted:Merely pointing out an annoying coding style. You mean the correctly named One True Brace Style?
|
# ? Jul 9, 2013 07:28 |
|
x264 usesC code:
|
# ? Jul 9, 2013 07:45 |
|
Deus Rex posted:You mean the correctly named One True Brace Style? Can't tell if I'm being trolled now since you pointed out the annoyance and then claim it is 1TBS. So I'll just state it: the annoying part is no space after if statement, but space after else statement.
|
# ? Jul 9, 2013 07:52 |
|
It wasn't clear to me from your follow-up post what the annoying part of the style you posted was or whether or not you had made a typo.
|
# ? Jul 9, 2013 08:22 |
|
code:
|
# ? Jul 9, 2013 10:00 |
|
Pilsner posted:
|
# ? Jul 9, 2013 10:33 |
What style you use really doesn't matter, as long as you use it consistently. I usually just adapt to the style of the codebase or my coworkers. For exampleJabor posted:What about if( <expr> ){? Isilkor posted:That's fine if that's the body of a loop where the entire work is done in the condition. vvv Hahaha. True, but it pays. a7m2 fucked around with this message at 11:43 on Jul 9, 2013 |
|
# ? Jul 9, 2013 11:37 |
|
Eruonen posted:Wordpress plugin. Horror spotted
|
# ? Jul 9, 2013 11:41 |
|
Aleksei Vasiliev posted:x264 uses The one truly wasteful and ugly brace style, yes. Opening curly on the same line as if is the way to go and we all know it.
|
# ? Jul 9, 2013 13:22 |
|
See, the thing that makescode:
I get that having the brace on the same line is shorter and cleaner in some fashions, but why would you suffer one newline character (which is a space otherwise anyway) to sacrifice easy human readability. I don't get why you wouldn't use brace-on-newline style.
|
# ? Jul 9, 2013 13:25 |
|
What's the consensus on blocks with single line statements?C code:
C code:
|
# ? Jul 9, 2013 13:29 |
|
Jewel posted:when you're going to the brace opening, you get your end brace, scroll your eyes exactly upwards, and bam, you're there. Scrolling your eyes up a column for an opening brace isn't any easier than scrolling your eyes up a column for not-whitespace.
|
# ? Jul 9, 2013 13:31 |
|
QuarkJets posted:And now you have also revealed that your team is using CVS Is that somehow sensitive information, or something which can be used against me or something?
|
# ? Jul 9, 2013 13:34 |
Having the brace on the same line is bad becauseC++ code:
C++ code:
|
|
# ? Jul 9, 2013 13:36 |
|
Jewel posted:See, the thing that makes If you don't have whitespace, yes, I can see where that's easier. However, most of the world can handle auto-indent, so not only do you not gain readability from knowing where the block starts, but you're also decoupling the brace from the if statement, which in my opinion actually makes this LESS readable. When I scroll my eyes up from }, I don't look for a {, I look for another line of code that's at that level of indentation. Consider what python does; no braces, indentation is its own mechanism of blocking. And it works, pretty well too.
|
# ? Jul 9, 2013 13:38 |
|
zylche posted:What's the consensus on blocks with single line statements? always use the braces even when they are not needed. prevents accidental "oh I'll just add another line of code to this block. welp something is wrong" bugs nielsm posted:Having the brace on the same line is bad because C++ code:
C++ code:
|
# ? Jul 9, 2013 13:40 |
|
Scrub code:code:
code:
That's actually the style I was taught in college. No idea why. They didn't bother to touch on anything important like source control, or a language people might use these days. Maybe that's how everything worked when my professors were "in the business."
|
# ? Jul 9, 2013 13:43 |
|
Brace style holy wars are the horror here
|
# ? Jul 9, 2013 13:51 |
|
The real horror begins when you and your coworkers can't stick to one style. That's pretty much it.
|
# ? Jul 9, 2013 13:59 |
|
I like apples because they are clearly better than oranges!
|
# ? Jul 9, 2013 14:24 |
|
Mogomra posted:Elegant Coad: Not exactly a common concern but this is useful for people with vision impairments as the spaces mean screen readers can read the code without sounding like an aphex twin song.
|
# ? Jul 9, 2013 14:33 |
|
Can we at least agree that people who indent with spaces instead of tabs are objectively wrong? It fucks up diff'ing.
|
# ? Jul 9, 2013 14:35 |
|
Volmarias posted:Brace style holy wars are the horror here Yeah, I never understood why people get so annoyed. I always stick to whatever the project uses, but really I don't even care if other people on the same project don't follow the convention. Unless you're doing something like never indenting, I just don't see how it makes code much more or less difficult to read.
|
# ? Jul 9, 2013 15:06 |
|
Pilsner posted:Can we at least agree that people who indent with spaces instead of tabs are objectively wrong? It fucks up diff'ing. Tabs for indentation, spaces for alignment within an indented block. So the following will appear lined up regardless of tab size: code:
|
# ? Jul 9, 2013 15:07 |
|
Sagacity posted:I like apples because they are clearly better than oranges! This is right-thinking. Pilsner posted:Can we at least agree that people who indent with spaces instead of tabs are objectively wrong? It fucks up diff'ing. 1337JiveTurkey posted:Tabs for indentation, spaces for alignment within an indented block. So the following will appear lined up regardless of tab size: Of course having an editor/IDE that corrects the poo poo to your team's agreed-upon standard and a diff viewer that can ignore whitespace is the best way to make it a non-issue.
|
# ? Jul 9, 2013 15:12 |
|
Pilsner posted:Can we at least agree that people who indent with spaces instead of tabs are objectively wrong? Nope. gently caress tabs, and use a not terrible diffing tool that understands whitespace.
|
# ? Jul 9, 2013 15:26 |
|
I never understood why people being able to decide for themselves how wide indentation levels should be would be a bad thing.
|
# ? Jul 9, 2013 15:30 |
|
VanillaKid posted:I never understood why people being able to decide for themselves how wide indentation levels should be would be a bad thing. Have you ever worked on a multi-developer project where people with various notions of "how wide indentation levels should be" are operating on the same code? That's why. Set a team standard, enforce it, flog all violators.
|
# ? Jul 9, 2013 15:32 |
|
No Safe Word posted:Have you ever worked on a multi-developer project where people with various notions of "how wide indentation levels should be" are operating on the same code? That's what tabs are for.
|
# ? Jul 9, 2013 15:33 |
|
fascinating
|
# ? Jul 9, 2013 15:42 |
|
I just go with "leave the loving VS defaults alone and save everyone a giant headache" Let's argue about the conditional operator next.
|
# ? Jul 9, 2013 15:42 |
|
VanillaKid posted:That's what tabs are for. Oh if you just mean the visual representation of how wide a tab is then yeah whatever, that doesn't actually affect the code so it doesn't matter. Although it is useful to use the same one across the team to encourage breaking lines at a reasonable length if you don't have a defined standard for line length.
|
# ? Jul 9, 2013 15:43 |
|
Are you people loving serious
|
# ? Jul 9, 2013 15:44 |
|
That Turkey Story posted:Yeah, I never understood why people get so annoyed. I always stick to whatever the project uses, but really I don't even care if other people on the same project don't follow the convention. Unless you're doing something like never indenting, I just don't see how it makes code much more or less difficult to read. I never got annoyed until I had to finish a product's firmware that had been done in Whitesmith's style. Couldn't tell what lined up with what for the life of me. Had the same problem last time I hosed around with Common Lisp - the parens were fine (my editor did some rainbow thing with em, which was surprising), the indentation just threw me for a loop.
|
# ? Jul 9, 2013 15:46 |
|
Wow, am I glad I don't work with any of you.
|
# ? Jul 9, 2013 15:51 |
|
|
# ? Jun 1, 2024 05:11 |
|
I imagine you all on the day of layoffs, sobbing and crying out "How could we fail? WE HAD A CODING STANDARD!"
|
# ? Jul 9, 2013 16:14 |