3 ms·
Sorry, I should have mentioned that I was not the GP. Even if you use spaces rather than tabs, the idea is the same. Do you mean something like the below? Note:
by clusmore 10y ago
Sorry, I should have mentioned that I was not the GP. Even if you use spaces rather than tabs, the idea is the same. Do you mean something like the below? Note: \t represents tabbing (not necessarily the number of tabs, just spacing using tabs), and _ represents spaces.
int f(int x,
\t\t__int y) // one 4-width tab, pad with spaces
{
\t\t// do stuff;
}
int f(int x,
\t\t\t\tint y) // one 8-width tab, whoops
{
\t\t\t\t// do stuff;
}
In this case, you should not be using tabs, since logically you haven't entered a new block yet and as such should not be increasing the indentation. It should be
int f(int x
______int y)
{
\t\t// do stuff;
}
- solipsism 10y agoEven if you use spaces rather than tabs, the idea is the same It's not, because there does not exist an editor that is smart enough to recognize that these 4 spaces are indentation tabs while these 4 spaces are spacing spaces. It's not impossible, but show me an editor that does it today (especially with C++) and I'll eat my hat :D I agree with you that if you're using actual tabs for indentation it works fine.
- clusmore 10y ago>It's not, because there does not exist an editor that is smart enough to recognize that these 4 spaces are indentation tabs while these 4 spaces are spacing spaces. Oh yes I see your point. All the more reason to use tabs for indentation and spaces for alignment. :)