Subject: Re: Time to update KNF?
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Greg Hudson <ghudson@MIT.EDU>
List: tech-kern
Date: 01/18/2000 10:47:03
> Second, on readability and comprehensibility, I find two spaces is
> simply too little. Try reading glibc code sometime; two spaces is
> just not enough. _If_ we decide to change, and M$ data says four
> spaces are as legible as two, I put in a strong plea for four.
So, I have a couple of cents to throw in.
First, when I started working for my group at MIT, most of the
programmers in the group preferred the gnu indentation style, so we
standardized on that. I thought I would hate it (being a four-space
K&R-style man by nature), but after a surprisingly short adjustment
period I found that it was just as readable as what I was used to.
So it may be that the studies Mike Cheponis cited weren't much more
than a popularity contest; if most of the participants were used to
2-4 space indents, then perhaps they'd be able to read them better.
Not having a copy of the original article, I can't be a good judge.
Second, I'll claim that two-space indents make more sense when you're
putting braces at their own level of indentation. The gnu indentation
style looks like:
if (foo)
bar;
if (baz)
{
quux;
quuux;
}
so complex bodies are actually indented at four spaces. (Obviously,
some people hate the fact that simple bodies are indented at a
different level than complex bodies; I refer them back to my first
point.)
Third, changing the indentation style of the KNF would be awfully
traumatic. You could say goodbye to automatically applying any
patches from non-reindented code. Since by all indications
indentation style is a fairly arbitrary choice, I think changing it
would be a big waste of effort.