Tabs or Spaces, Sup Forums?

Tabs or Spaces, Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=SsoOG6ZeyUI
suckless.org/coding_style
kernel.org/doc/Documentation/CodingStyle
twitter.com/NSFWRedditImage

Tabs ofc. Only retards use spaces

literally whatever you want. people that tell you "only retards use ...." are faggots whose opinion doesn't matter to anyone, and shouldn't matter to you.

>pressing tab key once or twice vs pressing space key 8 times
Well shit OP I really have no clue which is better.

2 spaces

Tabs. Only character dedicated to indentation

What shitty editor are you using where you can't set soft tab stops?

i'm honestly not sure if this is a joke or if Sup Forums is this stupid. people get into long, entrenched, seemingly earnest arguments defending more retarded shit than this, so i'm just not sure.

disgusting. this has to be bait.

say thank you to JS, its spreading like the plague. Tho I've seen pretty good programmers use only 2 spaces, like Terry Davis IIRC

and that hasn't prompted you to reconsider whether this is an important subject vs totally subjective?

you must be one hell of a zealot.

But should the tab key insert spaces or tabs?

Tabs....

WaIt iT CaN dO ThAt?!!?!?!?

WoWoWowoWowoWOOWoWowowo

of course its totally subjective. Code doesn't matter, only what it aims to do does. But we all love fighting about stuff like this.

Leave and go to China then you fucking commie, they have a character dedicated to every word

because Sup Forums is a haven for incompetent bike-shedders?

I can't actually believe people use spaces

it boggles my mind

>not just changing 'tab=4 spaces' in your settings

Is this really even a topic of discussion

Spaces, just because they render as expected everywhere. Usually 4 of them.
I don't actually indent my own code and anyone who does needs to stop editing well-defined structured documents in glorified text editors.

which settings?

Why would you want it to insert spaces when nothing is indented less than a whole tab length to begin with? I'm not having a go - legitimately curious.

A tab equivalent to 4 spaces is the only correct answer.

You fucks keep saying it's suggestive but it's not.

Le tabs use 4 indents on GNU/Linux but that renders as 8 on winshit. Or othe other way around.

Spaces are the only way to keep your code portable. What to do?

Bind 4 spaces to tab. It's litterally the only way to do it.

>type } and enter
>entire code before gets appropriately tabbed

>select everything and press tab
>it works

vs

>smash space 20 times before every single line

>select everything and press space
>it's gone
woooooooooooooow

People actually use spaces?

I thought that was just a meme on Silicon Valley

What are the benefits for spaces over tabs?

Most languages don't give a shit about the number of indents, how is portability an issue?

youtube.com/watch?v=SsoOG6ZeyUI

who's saying it's suggestive?
>Le
>feel guy
i wish you would kill yourself. if you can find anyone in the world who wants you to live, great, but i want you to know that there's at least one vote for suicide.

If you want it to always look the way you want it to. You can set the tab size in your editor, sure, but what about if you want to view in in a terminal, or notepad?

>Code doesn't matter, only what it aims to do does.
Only if you're an autistic loner
Enjoy your incapability to ever colaborate with anyo e when coding, your code rot and your unemployment

Spaces because I want to align everything nicely like:

var x = something();
var x2 = something();


With tabs, I have to use spaces anyways and I'm not aware of any text editor that seamlessly and correctly determines when to insert a tab (for indentation) vs. when to insert a space (for alignment).

/thread

So much this.

I use spaces but couldn't give a shit about what other people use. If you think tabs are more comfy, good for you, everyone has a different preference.

.vimrc

I use both, depending on the language.
Some languages are very verbose, so you have to use spaces to align it if you want it to be readable.
Tabs can be a bit harder to align stuff with.
It doesn't mean that I press space a million times, my editor does that for me.

you never had an actual job in programming right?

Yes I have, have you? Every job I've had uses spaces for indentation because there's always some dumbass who uses tabs for alignment.

this
/thread

I personally prefer tabs, since you can set them to any size so they're technically customisable spaces. It doesn't make any difference though.

No they don't, you filthy liar.

When I press the tab key it enters 3 spaces for me. This makes sure that readability is consistent across every piece of software providing that word wrap is disabled.

If you're going to use spaces, use a number that other people actually use.

No, three is fine, thanks easier to read than two and easier to manage when modifying code than 4.

i do spaces because im hardcore

Emacs indents everything automatically and when the fuckups build up I select the whole text and press tab so it pits everything where it's supposed to be.

But if you use tabs then anyone can set their tabstop to however many spaces they want and it will look the way they know they like code to look. Spaces make that impossible. For ascii art, sure, use spaces all you want. For code, there is literally no excuse

>Spaces make that impossible.
Wait, you're saying your editor can't do that automatically?

Can't what, display eight spaces as two? Maybe there's a vim plugin but as far as I know no, it's not possible

Tabs are objectively superior because
1) You don't need to press it as much as the spacebar.
2) Tabs are adjustable, spaces are not.

Anyone who doesn't use tabs in this day and age is a bonafide retard.

I use tabs for indentation, spaces for alignment. If I'm at work, I just use whatever they use, though.

I find that when I use spaces, I often find myself hitting the backspace button many times to remove unnecessary indentations; I know pretty much every editor has an un-indent button, but there are usually a few edge cases where that doesn't work.

What if you're new to coding and are just used to using spaces?

that'll fuck up alignment if you do something like this:
puts("kill"
"me"
);

>Spaces make that impossible
That's a feature in most editors. If it's not in your editor, then you can just do it with a regex find and replace anyway.

>I forgot that Sup Forums's font into monospace.
kill is supposed to be aligned with me on the quote.

kek

suckless.org/coding_style

Leading Whitespace

Use tabs for indentation

Use spaces for alignment

This means no tabs except beginning of line

Everything will line up independent of tab size

Use spaces not tabs for multiline macros as the indentation level is 0, where the#definebegan

>whats tab width
jesus fuck

literally this. Both have different properties.

You might be autistic and like the lower file size from tabs (which literally doesn't matter outside your weird personal preference)

You might be autistic and like spaces for more freedom or something gay like that (which literally doesn't matter outside your weird personal preference)

either way you're autistic

Tabs because there are fewer key presses. Also, this argument is rendered moot if you're programming in Lisp, like any sane human being would do.

Modern languages suggest you use spaces like python etc.
Also major companies like, Firefox use spaces.
Get a decent text editor which puts 4 spaces for a tab there's absolutely no reason to use tabs anymore

Clearly spaces, only retardeds use tabs, tabs aren't the same width on every environment. Youd have to be literally autistic to use tabs.

Tabs are cleaner
Spacesfags are scum

I don't know which is worse- you having code nested so deep you need 20 whitespace characters, or the fact you can't figure out how to turn on autoindent in vim.

>suckless.org/coding_style
>Use C99 without extensions (ISO/IEC 9899:1999)
stopped reading right there. gnu extensions, which are widely supported, fill in a lot of gaps that C99 missed, and C11 also has some useful features.

Their tabs/spaces explanation was the reason I linked it... I don't give two fucks about their philosophy of ISO C99 is best C.

ITT: people who think using spaces means pressing the space bar

>

There used to be a whole bunch of shit in the DOCTYPE tag, how come "html" and nothing else is sufficient now?

There're also styling guides for each language. Moreover, Linux kernel has one guides for coding in C, FreeBSD has other.

kernel.org/doc/Documentation/CodingStyle

"Chapter 1: Indentation

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.

Rationale: The whole idea behind indentation is to clearly define where
a block of control starts and ends. Especially when you've been looking
at your screen for 20 straight hours, you'll find it a lot easier to see
how the indentation works if you have large indentations.

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.

In short, 8-char indents make things easier to read, and have the added
benefit of warning you when you're nesting your functions too deep.
Heed that warning."

Because they put a 5 on the end.

tab expansion (to spaces)
I don't care how many
but I use 2

One space. It's always the same size on every platform.

Im trying to see the difference and I cant
Can anyone wtf is this ?

tabs converted to spaces

Indentation with tabs, alignment with spaces.

That way you can adjust tab size to whatever size you fancy, it keeps looking good, don't risk misalignments when backspacing because it deletes an indentation level regardless whether your editor is smart enough to understand what you want to do.

And if some colleague with a brain full of fuck makes an edit using spaces with different indent size you can change indent level until it matches and convert back to tabs. If you had used spaces now it'd be all fucked up and require manual intervention.

tabs
tab will always be a tab

spaces can be 2, 4 or 6 spaces

Tabs for indentation
Spaces for alignment

Why shouldn't I indent with 3 spaces? It saves on horizontal space so more layers are possible.

Tabs.

/thread

>hurr durr tap space bar twice to indent!
or
>hurr durr go through extra steps to set my editor to insert a non-standard amount of spaces when I hit tab
or
>hurr durr I want to force everyone to use MY indentation style!

which is it?

I shit you not, my boss used to work for a guy who used one fucking space for indentation.

This is advance autism , even worse than entire brackets placement debate

I use spaces everywhere, simply because it always works, nobody ever screws it up, and I have no reason to change it.

He writes spaghetti code with 10 levels of indentation.

If your project uses tabs, use tabs. If your project uses spaces, use spaces. If you get to decide, pick what you prefer and stick to the scheme that you have picked.

1. Tabs can only be used for indentation.
2. Spaces can be used for indentation AND alignment.
3. Mixing tabs and spaces is bad.

=>

If you're writing something where you need or want to visually align text you must use spaces. Otherwise tabs are okay.

Emacs does it perfectly

autism

And you're calling other people retarded? lmao

tabs!
spaces are for web "coders"

Is that powered toast man?

Whatever is the standard for said programming language.

I use tabs on odd lines and spaces on even lines.
Everyone that doesn't do this is retarded.