[Gllug] vi indenting

Nix nix at esperi.demon.co.uk
Thu Dec 20 23:31:44 UTC 2001


On Wed, 19 Dec 2001, Alain Williams said:
> The result is that my code (IMHO) is readable. I deplore the GNU/Emacs
> indenting style & high level of nesting that is often found.

Er, WTF? The OTBS brace style is

if (foo) {
    bar();
}

Compare to the GNU style (which I presume you mean, although the name
you give it makes me think you haven't read the GNU coding standards; it
is not related to Emacs, and Emacs can autoindent using dozens of
indentaton styles, including K&R, although K&R gives it a bit of trouble
because it is hard to find opening braces):

if (foo)
  {
    bar();
  }

Note that everything except for brace position is identical between the
two.

> Yes: I do need to occasionally spend some time reorganising code (ie
> chopping into functions) and yes, this does take time - but this time
> is repaid through lower on going maintainance costs.

Again, WTF? This has *nothing* to do with indentation style but rather
with default indentation depth (if that's the name) --- and I use a
default of 2 (for GNU projects) or 1 (for my own) for exactly the same
reason as you.

>> See <http://www.jwz.org/doc/tabs-vs-spaces.html>, one of the best
>> analyses of the subject I've seen. (Rather Emacs-centric, but given who
>> the author is this is perhaps to be expected. Besides, vi can do it
>> right, too; turn off the odious optimize and ruthlessly discard
>> tabs. :) )
> Tabs make things line up neatly & make a file smaller.

Tabs make things really ugly unless you can force everyone to use the
same tab size, or force them to never, ever convert tabs to spaces and
never, ever indent with spaces, and the disk space they save is
insignificant given modern storage costs.

So tabs: police state on a bunch of parameters you can't set in the
file. Spaces: no police state needed :)

-- 
`Mmm... Maybe I just like strong women that can hurt me?'
     --- Vadik, on female throat-cutting doctors

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list