How wide do you like your indents?

How wide do you like your indents?

Other urls found in this thread:

youtu.be/SsoOG6ZeyUI
twitter.com/NSFWRedditImage

Four spaces wide, but I use \t; I don't make pretend tabs with spaces like a moron

Tabs, usually 2. It's the aryan way and spaces are for the Indian.

8 spaces
I also like my {s on the same line as the statements:

3-space tabs

I use hyphens instead of spaces and use a preprocessor to get rid of them. I will change the font to change the size of the hyphen.

I'm new to programming (only several months into my studies) but why would anyone use spaces over tabs? Why press a button 4 times instead of one button once?

this
I cannot read code that returns curly braces.

Any editor more advanced than Notepad will let you use Tab to insert 4 spaces (and Backspace to delete 4 spaces)

autism and using command line

Herd mentality.

You'll find out when you try and import someone else's code. Also every single code editor that exists will automatically convert tab to however many spaces you want, and even auto align them for you.

But tabs don't have a specific size. That's the entire reason to use them.

>That's the entire reason not to use them.
ftfy

If you realize how retarded it is to use a non-monospace font what makes you think leaving whitespace (i.e. the most important aspect of formatting code) ambiguous?

2 spaces
tabs are for pajeets

Tabs displayed as 6 spaces.

>copy code properly formatted with hard tabs for indentation and spaces for alignment
>looks great, never have problems

>copy soft-tabbed code which uses a different indentation width than your code
>...

It wouldn't be ambiguous if everyone used tabs for indentation and spaces for alignment

does vim do this?
you're telling me people will press a button more times than necessary purely to be a hipster?
Wouldn't tabs appear easier to read than spaces though? Tabs = consistent exact measure. With spaces there is room for error.

>does vim do this?
If you do
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4

vim does that and a million other things

There's a great reason to use tabs in that your editor can represent it any way you want. The reason not to use tabs is because someone else's editor will represent it in a way they don't want because they're idiots.

3spacewidth tabs are superior.

Too easy for people to fuck up

It also wouldn't be ambiguous is everyone used X spaces for indentation. What's your point?

2 spaces, with comment blocks generally above what they documents instead of to the right to avoid OP's vertical alignment issue.

int someDemoCode(
int fred,
int wilma)
{
x();
print("hello again!\n");
makeThisFunctionNameShorter();

// line or block comments for the for loop here
for (int i = start; i < end; ++i) {
if (isPrime(i)) {
++numPrimes;
}
}
return numPrimes;
}

but X spaces is X, varies with every project.

But if everyone used spaces you'd be able to tell just from looking at it that it's X spaces. With tabs you aren't able to easily tell whether it's X spaces or 1 tab.

>int uWhat
>not
int
uWhat

How disgusting.

but thats a personal editor configuration problem

8 zeroes wide in a proportional typeface

ITT
>People who use text editors that cannot insert X spaces by pressing Tab
>People who use text editors that cannot delete X spaces by pressing Backspace
>People who use text editors that cannot change X space indent to Y space indent automatically
>People who use Notepad or functionally equivalent text editor.

Four spaces, no tabs.

8 characters-wide tabs and no more than 80 columns per line.

tabsize of 4, real tabs
I'd use 3 or 2 but it doesn't really seem to differentiate blocks enough. It's a good balance between compactness and visual distinctiveness.

sure, tab is defined as 8 spaces, but eh
the biggest benefit is that in this modern era, you can set the tabsize you view a file with to whatever you want

mate, you can configure your editor to place however many spaces when you hit the tab key, it's not like you're going to be hitting space 4 times every time you start a block

Listen to me.

The reason spaces are better than tabs is not because of editor disparity.

It is because statements that cross multiple lines require a mixture of tabs and spaces to align properly. Read any C codebase with an 80-character line limit that uses hard tabs. Mixed indents everywhere. Someone comes back later and hits tab to indent on a line that previously had a few spaces after the tabs to align properly, bam. You now have "\t\t \t".

Multiply this by 300,000 lines of code and 100+ collaborators and things spiral out of control very quickly. You can argue that code reviews will catch this, you can argue for automatic style formatters. Not everyone has these luxuries and they are not foolproof.

I love the concept of a dedicated indent character but it is flawed and spaces are really best for everyone.

I like my indents like this project triggered me.

That code looks familiar, what project?

Set your tabstop to 8 btw

8 spaces. I like 'em big.

>I love the concept of a dedicated indent character
Tabs aren't for indentation, TABs are for making TABles, like CSVs with tab separators instead of commas.

Typewriters had tab keys for making tables because they didn't have Excel back then. Typists also (ab)used the tab key for indentation since it's literally the same as pressing the space key multiple times and typewriter keys are hard as fuck to press.

Early computer files used TABs for indentation to save space and because the early primitive text editors didn't convert the Tab key to spaces. We are not living in the 70s anymore however.

>tabs vs spaces
youtu.be/SsoOG6ZeyUI

reminds me of this everytime

That's Erlang source code. As much as I hate the indenting, I've afl-fuzz'ed the shit out of it and it's the only language that has been fucking rock solid.

4 space tab here

i cant stand this. the only time my braces are on the statement line is when i can fit the entire contents onto that same line

i know that not putting the opening { on the same line makes you have to scroll a bunch more, but I'm borderline ocd about it.

i'm not a fucking asperger autist, i don't care, i just type Tab

#include

int main(void)
{
Tabprintf("Hello, world!\n");
Tabreturn 0;
}

made me kek

i mean i hit Tab, sorry for not being english
made me laugh though

>Tabs = consistent exact measure.
It's the exact opposite.

hard tabs, 4 space

It's perfect because anyone can set tabs to whatever they like on their editors of choice and not be anchored to spaces like plebians.

How do you enforce a line length limit?

Who gives a fuck about line lengths?

int main() { std::cout

In a perfect world I would do this as well.
Well, in a perfect world, there would be semantical programming language character codepoints for all stuff to take care.

this