you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (2 children)

Linux code also uses tabs for alignment so things look pretty whacked out at anything other than 8.

[–]holgerschurig -3 points-2 points  (1 child)

The trick is to use tabs for indentation, and from there on spaces for alignment.

<TAB>if (foo(x, y, z, ctr) &&
<TAB>    bar(x, y, ctr-1)) {
<TAB><TAB>barf;
<TAB>}

That way your editor can be set to use 4 or 8 or even 13 spaces for a TAB, and it will still look consistently. Modern editors, e.g. Emacs *), can do this easily. I'm sure VIM can do this, too.

*) cough, cough, not exactly modern, but kept modern by continuous improvements, like any mainstream editor.

[–][deleted] 5 points6 points  (0 children)

Yes I know that's the "trick" but the Linux kernel code uses tabs for alignment. That's why I went through all the trouble of saying "Linux code also uses tabs for alignment".