> Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.
Who the fuck indents with two spaces? What kind of scum force their shitty two-space indentations on others by not just using tabs? I'd wager it's the IDE fags. Fuck you.
default indentation by the ide, either 2 or 4. you can't be serious, taking up that much space for what?
William Reyes
The chad 4 space indent The virgin tab
Jackson Bell
Because more than three nested control flow constructs in the same function is pure cancer. Sometimes you just need to refactor your complex functions into smaller, more digestible subroutines. Nice, long indentations make your code easier to read (more "breathing room") and they let you know when your logic is too nested.
Also the thing where anyone can set the tab width however they like if tabs are used as indentation.
Brandon Harris
The default tab length in Nano is 8 spaces. And since Nano is the only editor worth using, the correct indention length should always be 8 spaces.
As the above alludes to, GNU's C style guide is an abomination. (Does anyone disagree on this? I honestly don't think so)
Lincoln Carter
>ide
>anyone can set the tab width however they like not strictly true, because there are some occasions where you need either 1 or 2 tabs to get things to the same column but of course it's gonna look wrong if you override the tab width to something wrong
Hunter Russell
I just found out about folds
Mason Butler
I say just be in the habit of not doing that. For example, it you have lots of arguments to a function, just indent once for the following parameters: // not actually that many arguments, but you get the idea my_type my_function(size_t first_argument, struct my_struct* second_argument, void* third_argument) { ... }
If you're lining up something like array elements, indent once, and then use spaces as needed: static const int my_array[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
Anthony Butler
I wasn't talking about that, I was referring to this kind of situation, which I find comes up quite often it'll look wrong if you change the tab width
Noah Perry
I think the advice still applies there. I'm also of the opinion that lining up struct members like you're doing there is a not-so-great thing to be doing, though it's not unreasonable.
Either way, have at it with spaces in that context. Use (8-space, preferably) tabs to indent your code in nested control flow constructs, use spaces *between* tokens in all contexts (for exactly the reason that you mention; they're not consistent across different people's editors).
Jonathan Edwards
thats because you're supposed to indent with tabs and align with spaces you mong
Asher Lopez
Python uses whitespace to group blocks of code instead of braces
Jacob Harris
>use the wrong tab width >expect my code to look right neither my fault nor my problem
Evan Watson
what are you talking about two is amazing
Henry King
8-character indentation is too much. I'm more concerned with people using pig disgusting cuddled else statements
Jace Gray
>Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you’re screwed anyway, and should fix your program.
Evan Rodriguez
Okay? This strikes me as nothing more than a "fun fact"; was it supposed to be an argument?
Look. I know the Python community has PEP8 so it's acceptable to use 4-space indentations for Python code. Either way, the interpreter (in Python3) only yells at you if you mix tabs and spaces; you can use tabs in Python code.
Josiah Russell
Not an argument, OP asked who indents with two spaces. Also: 1) relying on whitespace to separate blocks is terrible 2) tabs and spaces may be freely mixed in python 2, which is still extremely widespread
Jose Scott
JavaScript usually uses two spaces because things get super nested.
Liam Collins
Hard tab has no defined width and can be adjusted in an editor. There are only two sane ways to indent: all spaces or smart tabbing. With smart tabbing, you make zero assumptions about the width of a tab except for the fact that it is as wide as any other tab. Therefore, indentation is performed with tabs, and alignment with spaces. Further two lines may be considered aligned only if they contain the same number of leading tabs.
Zachary Lopez
What kind of autismo actually gives a shit about aligning their code into pretty little columns? >change a variable name >WHOOPS LOOKS LIKE I HAVE TO REALIGN ALL THIS CODE In sum, unless you're using Lisp, the One True Indentation is tabs and not aligning anything otherwise.
Ryder Perez
That sounds about right.
And thus smart tabbing is the one true way to indent. To indent with spaces at your own preferred width, while consistent, is a crime against your peers.
Austin Thomas
>mixing tabs and spaces haha no next
Lincoln Williams
You know unless that quote is from rms nobody on Sup Forums will even care
Joshua Stewart
It's from Linus. Stallman's got a one-track mind for free software, a lot of us care a care more about just code itself; kinda like Torvalds.
Dylan Gray
if you have lots of arguments to a function, you probably need a fucking struct.
Wyatt Bailey
...
Joshua Martin
>making a vector of shared pointers of subclasses of a pure virtual class just so you can print some emojis and /r/ns to the screen
Andrew Moore
python kek
Michael King
I like 3 space tabs. 2 is too narrow and 4 is fat
Parker Edwards
I do it just so autists like you can't overindent my code.
Christopher James
holy shit nobody cares, if you're working on someone elses project learn to adapt to their style. make your own damn project if you hate it so much
Justin Watson
Indent != alignment, autist.
William Murphy
spbp
Eli Watson
>>Who the fuck indents with two spaces? a team of highly educated autists at Google appear to think 2 spaces is the answer in pretty much every language: google.github.io/styleguide/ I think Go bucks the trend though.
Dylan Watson
void correct_indentation() { // 1 tab }
Landon Kelly
I put my tab size as 2 spaces, then I use tab.
Chase Gray
tabs indent, spaces align
now it doesn't matter how wide your tabs are. Let me configure my editor how I like, and you can configure it how you like.
Ryder Price
>function name on newline nah
Luis Ross
>not using the patrician choice of formatting multiple argumets int foo ( struct struct_t x, struct struct_t y, struct struct_t z ) { // ... }
Also if you typedef a struct you should unironically think of kys
Robert Harris
cuckthon 3 lel
Mason Ortiz
>forget a space >lmao all code is now broken tell me how replacing {} with indentation is a good choice?
Caleb Robinson
curly braces are aids at least use IF/ENDIF
Zachary Roberts
>Also if you typedef a struct you should unironically think of kys why
Ryan Wood
This is correct. 8 spaces is for psueds that want to be Linus 2 spaces is for webdev brainlets
Carter Ward
indentation 1 space it's false .. 2 or more space no benefit at all to readability.
Juan Richardson
>1 space you disgust so many layers of mine that you could write a protocol out of it
Thomas Cooper
>2018 >still not using 3.14 space indentation Pleb.
Adam Sanchez
Who the fuck cares, you fucking code monkey.
Michael Gray
for me, it is 32 space indentations. if you think this is too much, then you need to fix your code. for (var i = 1; i
Jace Foster
Tabs are 4 characters not 8 you tasteless shitter.
Luke Morales
You're retarded and didn't understand what he said.
Nathaniel Sanders
Please, you obviously need to rework your program flow. If 48-space tabs are too wide for you, then your program logic is broken anyway. Fucking plebs trying to shorten it to 32 (or even 8!) spaces are obviously cancer
Landon Williams
I understood perfectly
Brayden Diaz
>1) relying on whitespace to separate blocks is terrible I can't event count how many times, while editing code 5 or more indentations in, I lost a closing parentheses or a bracket. Yes, it's terrible code. And without a compiler it's not that easy to find them (Javascript) >2) tabs and spaces may be freely mixed in python 2, which is still extremely widespread You can disable the specified warning, as I do. Or just let your ide/editor fix it automatically.
Logan Wood
But function calls
Oliver Collins
curly braces have curves, they're the waifu of coding. Why would you want to throw them out
Leo Long
Who cares what it is? You can configure it in your editor to whatever you like. Furthermore, if people correctly use tabs to indent and spaces to align, it will be properly formatted no matter what you set it to.
Ryder Taylor
Why not? You can freely change the indentation width without fucking up the alignment. What's the downside?
Thomas Collins
You very obviously didn't. Or, you don't understand what "mixing tabs and spaces" means. Either way, you don't know how to format code
Angel Nelson
Tabs and spaces are used to different purposes here. If you do not feel your co-workers smart enough to follow a schema that clearly differentiates between indentation and alignment, the next best (and indeed only other acceptable) option is to use spaces for everything.
Tabs should never be used for the role of alignment, whether or not they are used for indentation.
Carson Sanders
. while(condition){ foo++; bar--; }
Center aligned, of course
Michael Perez
>using mla format
Grayson Richardson
it's ok until you get 3 tabs out in multiple if statements and your code no longer fits on the screen.
Camden Smith
> Tabs are 8 characters
Bull to the shit. A tab's length is completely arbitrary. It was always arbitrary, even when it was first used, on typewriters. For computers, the software decides on how to react to tab, it definitely isn't 8 characters by any standard or norm.
Aiden Nelson
you should not align code if you are using tabs, a mix of tabs and spaces is a shitfest that breaks the only purpose of actually using tabs in the first place
Elijah Ortiz
How many characters per line is acceptable for programming?
Nathan Hill
the CHAD brace styling
Hudson Adams
80. 160 if it's a verbose language. Readability is King though
Brody Thompson
I'm wondering if your comment goes nearly to "uhm... 2 spaces... more readable code".
Robert Diaz
You can hit the 80-char limit with like 3 arguments with slightly long type names. I wouldn't bother with a struct until you have like 7 or 8 arguments. It just makes your function a pain the ass to use otherwise.