top | item 28671630

(no title)

cool_scatter | 4 years ago

Which is the reason for the very common stance "tabs for indentation, spaces for alignment".

discuss

order

nybble41|4 years ago

Which is easy to say, but hard to make everyone do correctly. First you need to ensure that everyone uses an editor with a "visible whitespace" option, and turns it on, so they can see whether they have the right whitespace. Then you get to spend precious programming time turning one kind of whitespace into another since most editors will get it wrong when they auto-indent.

Either use spaces everywhere so you have total control over the layout or forego alignment (other than block indentation). Mixing tabs and spaces is a path to madness.

PaulDavisThe1st|4 years ago

This is part of the reason why editors for programmers and editors for general text editing are not the right thing.

I have F11 in emacs bound to whitespace-cleanup, which takes care of it all for me. And supertabs mode in general works just the way it should with tabs-indent/spaces-align.

Then there's also clang-fmt, possibley used as a post-receive hook in git (and some other VCS) which makes irrelevant what the programmer's editor did, mostly.