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?
lol
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 ;)
But more generally: just do whatever the surrounding code does, it's not a big deal ;)
I generally like tabs, but I often write code as:
Code:
and tabs fuck it up...foo(param1,
param2/*long long parameter*/,
param3/*yet another long long parameter*/);
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.
what kusma said. end of story. kthxbye
ofcourse after you've become like Navis you forget about these pointless discussions.
@psenough, hahahaha
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.
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.
Untabified tabs ftw.
is this pouet or some random basic and boring development board? BRING SOME UNICORNS!!!!
Tabs, imagine opening a can with a space.
tabs and a bit of space to align some data.
and I want my source code to look like ascii-art.
and I want my source code to look like ascii-art.
vs.
?
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.
Navis doesn't indent!
(tabs for me)
(tabs for me)
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
http://www.codinghorror.com/blog/2009/04/death-to-the-space-infidels.html
Space for stack manipulation, tab-space for arithmetic and tab-tab for heap access.
... and
void foo(void)
{
...
}
is bitchy.
void foo(void) {
...
}
plz.
I always wanted to say that to someone.
void foo(void)
{
...
}
is bitchy.
void foo(void) {
...
}
plz.
I always wanted to say that to someone.
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.
@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:
And also:
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 '. :
// : .' '. :
// ::................................::
//
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.
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.
SCHPEßES!