Tabs versus Spaces

The great debate.

Other urls found in this thread:

gnu.org/software/emacs/manual/html_node/emacs/Just-Spaces.html
twitter.com/SFWRedditVideos

tabs because i'm not a barbarian and realize that people can set their own tab widths

Are those dots supposed to represent spaces? What kind of mongoloid made this cartoon?

this
i like using 2 space tabs at work but 4 space tabs on my laptop
they're pretty common if you've ever used invisible characters in word or your text editor

Tabs are the obvious choice. Each tab is a single character representing an indentation, not some arbitrary number of spaces

three (3) spaces on the first indent
subsequent indents are two

> Not using automatic indentation

Are you coding with Word ?
Even Vim has automatic indentation by default (simulate tab not 4 monkeys spaces btw).

I like both, so I mix them in my python scripts. ;^)

Tabs, by far. 5 space tabs are the most readable, but I understand that others are fucking faggots and prefer 3 spaces.

Topkek

spaces. I shouldn't need to explain my choice.

I just press enter, every normal IDE automatically formats the text

I don't care since my editor indents for me. I drop a .dir-locals.el in the root of each project conforming to the style guide, since everyone is their own special snowflake with their own indentation style.

So tabs, then.

>indents
That's irrelevant. Every editor autoindents; Vim autoindents. The point is are those autoindents spaces or tabs? Are you too stupid to understand this?

4 spaces macro bound to the tab key

checkmate

tabs, unless my code is shit and I need like 9 levels of indentation. Which is never, since I'm not shit.

It doesn't matter? Each project has a style guide, I just follow the style guide instead of whining like an autistic child.

...

Tabs indent, spaces align.
Failing that, spaces only.
Tabs only is heresy.

You're the only actual autistic in this thread.

unless writing lisp, there is absolutely no reason to indent with spaces. it's about time editors got elastic tabstops, which would render that rule obsolete as well.

die

I agree, but if you're using languages with an official recommendation to use spaces (e.g. Python, Scala) you're better off following them. Tabs are a must everywhere else though.

Can anyone explain to me why you wouldn't use tabs?

If you use tabs to align, then you'll get alignment issues on other platforms.

It's because you're retarded
Class
Method
If
Loop
Nested loop
If
Loop
Switch
Case
How's counting out a million spaces going for you
Because that's what happens

Adjust your tabstops then you idiot. it's either 4 or 8 columns, no one uses anything else.

And again, elastic tabstops would shoot this crappy argument in the head.

Then you still have portability issues because nobody uses elastic tabstops.

That's why they should be widely implemented all at once.

Anyway, your use of spaces breaks portability with my proportional typeface.

Try to edit your tab file in notepad.exe

u wot

Literally never going to happeen.

no one cares

stop using spaces

stop being a special snowflake with unreadable code

But a tab is a tab is a tab right? It doesn't matter how it displays on other platforms as long as it's displayed consistently

You realise that "using spaces" is just a setting in the editor and every usage is the very same? You press the tab key to insert 4 spaces, you press enter and the indentation is already there.

If you use tabs purely to indent, then you don't get any issues. But if you use tabs to align (e.g when breaking up a function call into multiple lines) then things break.

gnu.org/software/emacs/manual/html_node/emacs/Just-Spaces.html

>Normally, indentation commands insert (or remove) an optimal mix of space characters and tab characters to align to the desired column.

>tab indents
>special snowflake
as far as i have seen, it's the most common

but that breaks portability! not all editors treat contiguous spaces as tabs!

Why is this still asked.
Every single IDE worth it's salt and half decent vim config sets tab to equal some number of spaces anyway.

we need a final solution to the indenting with spaces question

>but that breaks portability! not all editors treat contiguous spaces as tabs!

Not all editors are created equal.

not all programmers are stupid enough to indent with spaces

At least they display spaces in the same way. Unless you use just spaces for alignment, tabs break portability even worse.

>At least they display spaces in the same way.
not if you're using a proportional font. and by the way, your bemusement at using a proportional font to program in is equal only to my bemusement at your using spaces to indent

>tabs break portability even worse
just adjust your tabstop, it's no more difficult than having to change the number of spaces spat out on pressing tab

If you're not smart enough to know how to adjust your tabstop size, you're too stupid to program in the first place. KYS.

spaces
If you use tabs, some faggot will have them as 56 spaces and will ruin your formatting and readability. Spaces allows the creator cashmere control on the readability of the source.

it's actually a debate of tabs vs 1 space vs 2 spaces vs 3 spaces vs 4 spaces,etc...

>cashmere control
>he can't adjust some other guy's tabs

Surely with Unicode we can create a character specifically used for indenting code?

So instead of the code looking aligned out of the box, I have to figure out what settings the previous author had and change my IDE for him? How about everyone just use spaces and we don't even have this fucking problem?

It literally already exists.
It's tabs.
Although they were not invented for this purpose, they get the job done far better than any other character.

>indenting

>he doesn't program with a monospaced font

create these vs threads on reddit, stupid children

lol 1/10

>indentation level of 1
>requires four (4) characters to achieve
why are space-fags so retarded?

Tabs are better

>WAH I NEED TO BE ABLE TO VIEW OTHER PEOPLE'S CODE IN MY UNUSUAL WAY THAT DOESN'T CONFORM TO THE STYLE GUIDE

How to know if someone is a koder 101

At my workplace we use indentation of 5 spaces, tabs forbidden. I've been told to not even ask.

The good thing for me is I just write code however I want, and ctrl+shit+l auto-formats everything for me.

Odd indentation? It's time to leave user.

why press 3-5 buttons when you can press 1?

Over just odd indentation? Please. There are three things I dislike the the coding standard: Curly brace is on the new line, indentation is 5 spaces, and member function names are pascal-style DoThisAndDoThat() (compared to what I'd prefer, doThisAndDoThat()). Apart from those, everything's great. I even like the team. And the pay is great.

And they use non lowercase for function names in C. Two reasons to leave user. The technical chief is an incompetent code monkey.

It's C++.

Actually I even mentioned member functions. C only has function pointers, you dun goofed up, it was clear from my post I was talking about C++.

>DoThisAndDoThat()
You retard it should be DoThis() and DoThat()

The bigger problem here is you're a bad software engineer.

I think you need to rethink your assumptions here.

>what is soft tab

See, this is why tabfolk will always lose. They lack the curiosity of human species and are subhuman monkeys who can't even open editor settings. They are less productive, less informed, less understanding of their tools and generally dull disgusting people who likely vote far-left parties and would cause death of millions via starving if ever given power over anything more than a burned match.

Tabs, it's not the 1970s anymore no matter what the old farts and their autism say.

>practice fizzbuzz and bubble sort for 72 hours straight in every language
>go into interview at big prestigious tech company
>user, do a fizzbuzz on the whiteboard
>I do it perfectly, gonna get the job
>Got rejected: I used tabs instead of spaces

>tabs instead of spaces
>on a whiteboard
kek

Why post on Sup Forums when you've never used an editor in your life?

Spaces.
Tab is a relic of the past.

If tab characters were for indentation, they'd be called "inds", but they aren't. Tabs are for tabulation. That's why they vary in width to align to the next tabstop.

However, even using tab characters for their intended purpose of tabulation is pretty bad. You have to use a varying number of tab characters depending on the width of cells in your table. And this becomes even worse when people change their editors / terminals to use something other than the standard 8-char tabstops which changes the amount of tab characters you need between varying sized cells.

When you use tab characters for indentation, you create inconsistencies when wrapping to a fixed column width, for example wrapping comments to 80 columns. And some people who change to 2 char tabstops might end up writing much longer lines which look bad to someone who uses 8 char tabstops. The idea that tabs give different people their own choices in indentation width is a waste of time. It always can ruin formatting in certain ways using tab characters, even if you use spaces for alignment, and in any case it's still forcing the usage of tab characters upon developers just as much as a different project might force the use of four spaces. There's always going to be a prescribed style for formatting in projects so why bother?

Speaking of the whole spaces for alignment and tabs for indentation thing, this is limited in that you can't indent things after aligning things. It's pretty popular to do this in languages with lambdas such as LISP and Erlang. It also can make things like a fair bit neater and easy to see the hierarchy doing this in languages like JavaScript. However this doesn't work if you use tabs for alignment because they are variable width if they have any number of characters before them on a line which aren't all other tab characters. Besides other contributors messing up the tabs + spaces mix, it's also not nice to have to rely on listchars in vim or equivalent in normal code.