5 ms·
At least in C, I like to line things up sometimes: void function_with_lots_of_arguments (int arg_a, int arg_b,
by udp 14y ago
At least in C, I like to line things up sometimes:
void function_with_lots_of_arguments (int arg_a,
int arg_b,
int arg_c);
If I was to use tabs and someone had a different tab width to me, they might end up with:
void function_with_lots_of_arguments (int arg_a,
int arg_b,
int arg_c);
- wolfgke 14y agoIn 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); };
- cheradenine01 14y agoYes, 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.
- deleted 14y ago[deleted]
- markokocic 14y agoThat's where one single rule helps: use only tabs for indentation and only spaces for alignment.
- dylan-m 14y agoIf 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).