Re:Applying the Linus Torvalds “Good Taste” Coding Requirement
by clusmore on Wednesday October 26, 2016 @03:15AM
(#12794521)
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;
}
Re:Applying the Linus Torvalds “Good Taste” Coding Requirement
by solipsism on Wednesday October 26, 2016 @03:38AM
(#12794624)
Even 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.
Re:Applying the Linus Torvalds “Good Taste” Coding Requirement
by clusmore on Wednesday October 26, 2016 @03:41AM
(#12794639)
>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. :)
What does "I convert it back to 4 space tabs before I commit anything" mean, then? If you're putting \t tabs in your file, 4 space tabs vs 8 space tabs refers to the way your editor renders \t. What are you changing before committing, your editor settings?
Edit: oops, just realized you're not the person I was responding to. The convert it back before I commit anything comment suggests he/she is using spaces. Or is very confused.