by tbabb · 9y ago · 0 comments
int f() {
int someVariableName = myFunctionCall(expr(5), // <--- line A
somethingElse(9), // <--- line B
a_long * expression + involving(multiple.subExprs));
int d = somethingElse; // <-- line C
}
...you're saying line A is indented with tabs, and line B with spaces? Because that will misalign if your tab setting isn't the same.Or are you saying that both A and B are indented with spaces? Then what about line C, which will misalign with A and B if your tab stop is a different width?
Or do we indent the entire body of f() with spaces, and then in that case you're basically using spaces everywhere, which the good idea that sparked this whole thing?
/*t*/int f() {
/*tabs*/int someVariableName = myFunctionCall(expr(5), // <--- line A
/*tabs*//*--------------spaces--------------*/somethingElse(9), // <--- line B
/*tabs*//*--------------spaces--------------*/a_long * expression + involving(multiple.subExprs));
/*tabs*/int d = somethingElse; // <-- line C
/*t*/} int f() {
<tab> someVariableName = myFunctionCall(
<tab><tab> expr(5),
<tab><tab> somethingElse(9),
<tab><tab> a_long * expression + involving(multiple.subExprs)
<tab> );
<tab> d = somethingElse;
} 1 int f() {
2 >---int someVariableName = myFunctionCall(expr(5),
3 >--- somethingElse(9),
4 >--- a_long * expression + involving(multiple.subExprs));
5 >---int d = somethingElse;
6 }
Tabs only for indentation (lines 2 to 5), spaces for alignment (lines 3 and 4). This is easy to achieve if you use Vim with Smart Tabs for instance (https://vim.sourceforge.io/scripts/script.php?script_id=231).B is indented with a tab, plus the requisite number of spaces to line up with the above line.
C is indented with a tab.