Quoting (e-mail address removed), on Wed, Mar 23, 2005 at 08:17:53AM +0900:
Yay! Let's start a tabs vs. spaces flame war!!
My view? Tabs should never, ever be used in a file. (Ever) Can you
have a source code file without spaces? I doubt it. Can you have a
file without tabs? Certainly. Is mixing the two the main problem?
Yup. Use only spaces.
It's funny though. I think this eternal flame war is related to the
other eternal flame war: vi vs. emacs. In Emacs, the 'tab' button is
most often bound to 'indent-command'. This and 'indent-region' makes it
really easy to use spaces for indentation, and to adjust/fix someone
else's indentation when it's bad. On the other hand, I think vi makes
Select the area, or whole file (%=), and press "=" in vim to do this. I
suspect = is standard on the ancient vi as well.
it much harder to use spaces for indentation, so tabs seem more attractive.
That's funny, I haven't found that emacs uses spaces to indent by
default. Its supposed to default to the GNU coding standard, though what
it does on any machine is pretty subject to the whims of who installed
it. The emacs standard/GNU indent style is the weirdest around, IMO.
foo()
{
int ;
if()
{
...
It uses TAB by default (every time indent gets over 8 chars, it uses a
TAB). I've always though the GNU coding style was specified to showcase
the power of the emacs indentation engine. I never got vim to do it, but
I just fed my functions through GNU indent, and whatever it looked like,
I comitted. Can't be acused of not following the GNU coding standards
then, GNU indents output is supposed to follow it!
I'm pretty easy about coding styles, everwhere I've worked has a
different one, the important thing is that people have the same one if
they work on their code a bunch. I do confess agreement with the 8th
commandment for C programmers:
Thou shalt make thy program's purpose and structure clear to thy
fellow man by using the One True Brace Style, even if thou likest it
not, for thy creativity is better used in solving problems than in
creating beautiful new impediments to understanding.
Particularly the last phrase abou where your creativity should be
focussed...
The only one style actually dislike is the GNU one. Also I think any
standard that I can't remember is way too detailed.
I'm averse to indents over about 4, and I think tabs are lame. They work
fine if everybody on your team uses the same settings, but when anybody
else looks at your code, it will look bad.
I think a bunch or ruby core developers (matz, for one) use emacs, so
many of the files use tabs, and indent two char widths per nesting
level. Not all, though.
Cheers,
Sam