Re:Poll: Spaces or tabs?
by udp on Saturday February 02, 2013 @11:16AM
(#5156327)
At least in C, I like to line things up sometimes:
If I was to use tabs and someone had a different tab width to me, they might end up with:
[ Parent
| on HN ]
If you're trying to line things up with tabs, you're doing it wrong. Tabs are for indentation. Lining up columns is not indenting. (I'd also argue that trying to line stuff up like that is, nine times out of ten, doing it wrong: it inevitably leads to an if statement where the consequent is indented as much as the last line of conditions. If people are swearing by a style guide that says "always do this," and it's that, at least some of their code will end up being messy anyway).
In this case you use spaces for the parts that shall be lined up and tabs for the rest. Example:
class Foo
{
\tint bar(int a,
\t int b);
};
Re:Poll: Spaces or tabs?
by cheradenine01 on Saturday February 02, 2013 @03:01PM
(#5157111)
Yes, but you can't tell in your editor if you've got
\t int b);
or
\t\t int b);
Because they'll look the same to you, but not to anyone else without 4-space-tabs.
That is correct. But you do know the indentation rule so you know that the int b only has 1 tab followed by spaces.
There are editors that have such a feature (for example called "show whitespace" or "show spaces and tabs").
Re:Poll: Spaces or tabs?
by markokocic on Saturday February 02, 2013 @11:26AM
(#5156367)
That's where one single rule helps: use only tabs for indentation and only spaces for alignment.