I understand spaces for aligning assignment operators and such, but for start-of-the-line indenting I can't understand why people would use spaces.
I use tabs for the following reasons:
1. If I am 3 indents in, I don't want to be mashing and counting 3*(tabSize) spaces. It's a waste of my time, keyboard and counting.
2. The text editors I use all auto-indent with TABS. I'm not going to give up auto-indenting or visual studio/notepad++ for this.
3. When its the start of a line, who cares how big the TAB is? It can vary depending on the user's preferences (that being said, 8 is wayyyy too much).
Why do you space-purists prefer spaces?
Ahhh, isn't that interesting, I just found a "replace tab with spaces" feature in visual studio. I'll try it out and see if I like it. Even if it simply prevents me from consistently CTRL+H'ing my code so that I can put it on this forum, it'd be useful.
@Stewbond
1. Most editors can treat groups spaces as if they were tabs. CodeBlocks' editor does. gedit, which I use, doesn't, but it does have an unindent function (shift+tab) which unindents an entire block of code. If not, just hold/tap backspace until the text after the cursor is aligned with the right indentation level (if you have other code at that level to use as a guide, or if you have indentation guides on your editor). Alternatively, what I do for single lines is to press shift+home and then press backspace or delete. In short, learn to use the keyboard shortcuts.
2. You should be able to configure them to use spaces. I'm fairly sure notepad++ can.
3. 8 is the standard.
Stewbond wrote:
Why do you space-purists prefer spaces?
I started with spaces, but then I switched to tabs. I switched back to spaces because I didn't want to stop using spaces for pretty-printing and I didn't want to mix tabs and spaces (because it leads to weirdly-aligned code when some blasphemous fool uses a different tab size). You're right that 8 columns is too much for a single indent, but I still firmly believe that 8 columns is the one true tab size, so the only way to use smaller (or larger, if you are so inclined) indentations is with spaces.