[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Tabs vs Spaces

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 32
Thread images: 3

File: wv3SXGZ.jpg (414KB, 3000x1688px) Image search: [Google]
wv3SXGZ.jpg
414KB, 3000x1688px
Alright fa/g/ots, time to see which one is superior.

Here's the poll: http://www.strawpoll.me/13144200
>>
File: 1469391359469.png (33KB, 800x500px) Image search: [Google]
1469391359469.png
33KB, 800x500px
>>
>>60816858
Tabs don't have to mean 4 spaces, you do know that right?
That's why they're superior. You can configure how many "spaces" a tab is.
>>
>>60816858
tabs that make spaces
>>
tabs to indent, spaces to align
>>
>>60816898
>mixing tabs and spaces
This is why spaces are the only option.
>>
>>60816917
Why is that bad? Just have your IDE replace any 4 spaces with tab, if you ever accidentally fuck up.
>>
>>60816877
Proper tabs are equivalent to eight spaces you sack of shit.

Linux style is the only valid style.
https://www.kernel.org/doc/html/v4.10/process/coding-style.html
>>
space master race
>>
>>60816970
>>60816890
these guys know what's up
>>
File: bait-20.jpg (88KB, 540x530px) Image search: [Google]
bait-20.jpg
88KB, 540x530px
>>60816858
Question is bad. On a properly configured system, it simply shouldn't matter.

>Tabs don't have to mean 4 spaces, you do know that right?
And the reason this is wrong is exactly why. "Variable" tabs just break whenever you try to change the tab width. Consider the following hypothetical but properly aligned expression:
    while((a || b) && ((c && d) ||
(e && f)) &&
(g || h))

Now change your 4-space-tabs to 8-spaces and watch the carnage:
        while((a || b) && ((c && d) ||
(e && f)) &&
(g || h))

That's what would happen unless you very thoughtfully use tabs for "block indentation" and then spaces for "expression indentation" or whatever, and nobody (nobody in their right mind, one might add) does that.

That's still a relatively simple block of code, too. The more 2D layout you use, the more broken the retarded idea that tabs can be changed becomes. Tabs do one thing and one thing only: They advance the cursor to the next column ordinal divisible by 8.
>>
>>60816898
    emitface    (a, b, d);
emitface (b, c, d);
if(backface) {
emitface(a, d, b);
emitface(b, d, c);
}
>>
>>60817298
>Tabs do one thing and one thing only: They advance the cursor to the next column ordinal divisible by 8.
Notable is also that this is how tabs work everywhere except in stupid IDEs (and web browsers, probably not a coincidence), so when you use tabs incorrectly you mess up every other program trying to display your files.
>>
>intro CS class
>university style dictates three spaces (God only knows why; likely to flush out what comes next)
>there are a majority of people that slap the space bar three times for indentation
>if they've got multiple levels, they space six, nine, or more times
>thought it was just retard freshman
>later had a class where the teacher, who had worked as a programmer, used the spacebar for indentation
>>
all of you are retarded;

heres why tabs > spaces


tab tab tab tab

vs


space space space space space space space space space space space space space space space space

geee i wonder which one is more efficient
>>
>>60817578
>being this stupid
No one but the cuckest of cucks uses the spacebar for indentation. The question is what the tab button does.
>>
>>60816858
lmao strawpoll doesn't fucking work
i literally got a fucking raw json file when I tried to vote
>>
>>60817593
This, but I'm curious what people of other editors do, more precisely. In Emacs, the Tab key simply autoindents. While it's not my primary editor, I know that Tab in vi always inserts Tab characters, and that ^T is used for soft-tabbing. What does Your editor of choice do?
>>
>>60817891
I set the tab key and auto indentation rules to follow whatever the project standards are. If the code base wants 3 spaces, my tab key puts out three spaces. If it wants tab characters, it does tab characters. It also does the correct indentation whenever I go to a new line after I start a for/if/whatever block. It takes a single variable assignment to do this. Any reasonable editor should be able to do this. I use Vim.
>>
2 spaces. Like all the competent developers around the world.
>>
>>60816858
Tabs can break the fuck out of SQL though.
>>
Spaces because different systems can show the tab "character" differently than what you had originally intended. A space is always a space.
>>
>>60819970
^ this unironically.
Also, why is this not an option in the poll?
>>
>>60821212
Guess what kind of dev made the poll.
>>
S P A C E S
P
A
C
E
S
>>
>>60817298
This is why you use tabs to indent and then use spaces to align things.
It's common sense.
But yeah, as you said, barely anyone does it from what I've seen.

The worst part is most IDEs are fucking terrible at working with Tabs.
Also, having a ruler to change the tab indent dynamically would be very handy, rather than having to go in to options. (even just a menu option would be good!)
>>
Project style guide > language style guide > your opinion

Tabs (8-aligned) if the language is good at avoiding nesting (C and Go, dunno about any other), 4 spaces for majority of langs, 2 spaces for HTML
>>
>>60816877
and then every other editor you encounter has it configured the way you don't want.
>>
>>60816858

Tabs to indent, spaces to align.
>>
>>60816984
eeeeeeeeeeeeew
wtf
kys
>>
>TABlets detected im this thread.
>>
>>60824755
>align
Disgusting.
Thread posts: 32
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.