4 ms·
You said.. > Programmers who use hard tabs for indentation also use them for inner alignment, like this: But note that OP said.. > > Tabs are for indentation
by swaits 11y ago
You said..
> Programmers who use hard tabs for indentation also use them for inner alignment, like this:
But note that OP said..
> > Tabs are for indentation, spaces for alignment.
The distinction is important. Programmers who use both can actually realize the best of both worlds. I know this is a religious topic, but I've seen it work very well. Hear me out.
I managed teams of game programmers for about 15 years. We used mostly C, C++, and later, C#. It took me some work to get everyone on the same page with this, but once we achieved it, everyone was happy.
The end result is that indentation and alignment worked for everyone on the team. It didn't matter what tab size each individual configured in their editor of choice, everything just worked.
- kazinator 11y agoYou can use variable sized tabs if your leading whitespace consists of tabbed indentation, followed by alignment spaces. E.g.: [TAB][TAB]object.function(argument1, argument2, [TAB][TAB] argument3); For this to work, all alignment among lines must occur only among lines which are at the same indentation level; alignment must not cross indentation levels. However, internal alignment must not use tabs. Only indentation may use tabs; all else is spaces. If you allow tabs for indentation, internal tabs will sneak in, because some people use dumb editors or don't know how to use their good ones. You just need some repository commit hooks to catch that. However, the whole thing is misguided. If tabs are used at all, tab stops should be set to the de facto standard 8 by everyone. And then these tab stops should be freely used for internal alignment between lines, not only for indentation. Either fully invest in tabs and embrace them, or don't use them at all.