pouët.net

Go to bottom

Tabs versus Spaces, whats your stand about it?

category: code [glöplog]
This is one of those things that I just can't believe that no standard have taken over the other... SO, what's your opinion?
added on the 2012-05-16 20:37:11 by TLM TLM
lol
added on the 2012-05-16 20:38:41 by TLM TLM
My personal preference is tabs for indentation, spaces for formatting. That way, people can adjust their settings to whatever tab-width they prefer, and the formatting won't break.

But more generally: just do whatever the surrounding code does, it's not a big deal ;)
added on the 2012-05-16 20:39:40 by kusma kusma
I generally like tabs, but I often write code as:
Code:foo(param1, param2/*long long parameter*/, param3/*yet another long long parameter*/);
and tabs fuck it up...
added on the 2012-05-16 20:43:17 by TLM TLM
what TLM said, except that I also place a tab after the opening parenthesis. It's ugly, but it's tab-aligned. Anyone know a better solution? I dislike spaces for identation.
added on the 2012-05-16 22:13:04 by xTr1m xTr1m
what kusma said. end of story. kthxbye
added on the 2012-05-16 22:15:24 by steam steam
ofcourse after you've become like Navis you forget about these pointless discussions.
added on the 2012-05-16 22:22:45 by psenough psenough
@psenough, hahahaha
added on the 2012-05-16 22:27:32 by raizor raizor
Writing code like that is a pain in the arse anyway, if you later change foo to fooWithExtraMetaballs and have to fix the spacing of the stuff below it to make it line up again. I'm writing code, not ASCII art.

The number two reason for using tabs, after what kusma said, is this: no-one actually taps the space bar four times to indent, do they? No, they use the tab key. So the question actually becomes: "what sort of character do you want the tab key to insert?" Well, let's see. You could have it insert a tab character, the character that specifically exists in ASCII for that purpose, the one that every non-broken text editor in the world, including, heaven forbid, Notepad, supports inserting when you press the tab key. Or you could have it insert a specific number of spaces, and require everyone else on your project to also use an editor that's full of internal hacks to make that specific number of spaces behave more or less the same as a tab character.

Indenting with spaces: just say no, kids.
added on the 2012-05-16 22:30:44 by gasman gasman
Untabified tabs ftw.
added on the 2012-05-16 22:33:14 by kbi kbi
is this pouet or some random basic and boring development board? BRING SOME UNICORNS!!!!

BB Image
BB Image
added on the 2012-05-16 22:48:12 by kbi kbi
Tabs, imagine opening a can with a space.
added on the 2012-05-16 22:52:19 by FreeFull FreeFull
tabs and a bit of space to align some data.

and I want my source code to look like ascii-art.
added on the 2012-05-16 23:09:11 by rez rez
BB Image
vs.
BB Image
?
Hmm. Well 1 you can drink - even if it does taste a bit like shit. The other will explosively decompress you, boil your blood and burst your eyeballs.
Undecided.
added on the 2012-05-16 23:39:15 by ringofyre ringofyre
Navis doesn't indent!

(tabs for me)
added on the 2012-05-16 23:41:26 by Preacher Preacher
I use tabs, but you should use Vim to see my code correctly... since nobody read my code I don't care :P

http://www.codinghorror.com/blog/2009/04/death-to-the-space-infidels.html
added on the 2012-05-17 01:21:35 by qwesza qwesza
Space for stack manipulation, tab-space for arithmetic and tab-tab for heap access.
added on the 2012-05-17 03:28:55 by Danguafer Danguafer
... and
void foo(void)
{
...
}
is bitchy.
void foo(void) {
...
}
plz.

I always wanted to say that to someone.
added on the 2012-05-17 03:31:57 by Danguafer Danguafer
I used tabs for quite a long time, but then I suddenly began writing a lot of ridiculously portable code in quite a few IDEs/editors (vim, Xcode, kwrite, notepad, qt creator, visual studio, nano, notepad, textedit to name a few), sometimes simultaneously, and tabs started to be quite a pain. So I switched to spaces. Also, 2-space indentation helps -- it is visually enough, and makes deeper nesting still readable.
added on the 2012-05-17 06:49:48 by provod provod
@gasman: In a way, I really do look at code as ASCII art. In fact, I often draw comments using ASCII editors and copy-paste them into the code.

Example:
Code:// Axis Defenitions // // +Y // ^ -Z // | / // | / // |/ // +------> X+ //

And also:
Code:// Primitive_Box surface numbers // ::'''''''''''''''''''''''''''''''':O // : '. .' : // : '. 6 Top .' : // : '. .' : // : '..................' : // : : : : // : : : : // : : : : // : : 1 Back : : // : 2 Left : 4 Front : 5 Right: // : : : : // : : : : // : : : : // : .O'''''''''''''''''. : // : .' '. : // : .' 3 Bottom '. : // : .' '. : // ::................................:: //

added on the 2012-05-17 07:00:29 by TLM TLM
oh my god that cube, it has a face :O

What kusma said. I have no cool reason for the tabbing though because I rarely spread my code, but it's faster and usually automatic after the first indent.
added on the 2012-05-17 08:18:48 by msqrt msqrt
SCHPEßES!
added on the 2012-05-17 08:51:29 by rac rac

login

Go to top