LB wrote: |
---|
The only issue here is that the alignment says the functions are related even though they might not be related at all. |
I would make that distinction by adding at least one empty line between groups of related functions.
Have a look at these:
[...]
Is that what you consider "mixing tabs and spaces"? |
Those all look fine. And no, that's not what the issue I'm referring to.
I'm referring to this:
1 2 3 4 5 6 7 8
|
void some_code()
{
int x = 0; // some aligned comments here to add
if( whatever == 5 ) // flavor and/or
{ // descriptive context
x = 10; // to this
} // code
}
|
Or... as it looks in my editor:
http://imgur.com/MqNt5YO
(note I have it open as a txt file, hence the spelling underlines and lack of syntax highlighting... but you get what I'm getting at)
EDIT:
I don't mind hitting the space key a lot to make the code look nice. |
Neither do I. It's just easier (and habit) to use tab since you don't have to press it as much. Particularly if there's a lot of whitespace between where you are and where you want to be.
I just want to clarify to everyone: I never use tabs in my code after primary indentation. I never use spaces in my code before or during primary indentation. |
This is the
only way to do hard tabs properly. So you're doing it right. Good on you.
My point is that most people don't do it right. Most people screw it up.
On the other hand... nobody ever screws up spaces because it's impossible.
EDIT 2:
We can go back and forth about this all day... but I think it comes down to this:
advantages to using tabs:
- Smaller file sizes.
- User can specify their own tab size even when reading others' code.
disadvantage to using tabs:
- Requires extra caution when making pretty-print aligned code
So it really comes down to personal preference as to which one you feel outweighs the other.
Personally, with the amount of alignment I put in my code... I feel the advantages to tabs are simply not worth the extra work involved.
Apparently, LB, you disagree.. and feel the extra work is trivial.
I don't really know if there's more that can be said on this. =P But it's a fun discussion anyway.