The PBP suggests using spaces to indent all code lines, instead of hard tabs. The hard tab character should appear nowhere in a file.
I disagree with this, but have given up the argument and simply do it anyway. I feel it a minor loss, and not worth the confusion it causes from people who don’t understand hard tabs.
Really, they’re neat. They mean I can tell my editor, “hard tabs are xx wide” and it will keep the indentation right. Nothing but the initial indentation should use hard tabs, so that everything past the indent stays correct.
That’s not what happens, though, so things look dorky if you change the settings, so nobody wants to, so we may as well use spaces.
So, use spaces, and get an editor smart enough to manhandle the code around to where it’s how you want it. It’s just how the world works.
(Except for Makefiles, which still demand hard tabs and screw up virtually everyone who uses them infrequently.)
I must respectfully but firmly disagree with your assertion “and get an editor smart enough to manhandle the code around to where it’s how you want it. It’s just how the world works”. It only works if you work in a small team with everyone 100% of time viewing the code in the same editor. Never happens in real world. You view the code diffs for code review? Both “diff” in Unix and Atlassian Crucible will display your hard tabs as incredibly mis-formatted code. Use “vi” or “pico” to quickly scan/edit through code in your terminal? BAM! Your code looks awful.
I actually agree with you. By “get an editor smart enough” I meant to suggest one that works as if you have hard tabs of your favorite width, and yet writes out an agreed-upon number of spaces.
The concerns you have – the very valid concerns! – are exactly true… if everyone isn’t using spaces. With spaces saved to the file, you avoid the problem.
I think we agree, except that I wasn’t as clear as I could have been.
It is my hope that someday we will have good IDEs that support proportional spaced typefaces, and then this will need to be revisited.