Subject: Re: Time to update KNF?
To: Simon J. Gerraty <sjg@quick.com.au>
From: Ted Lemon <mellon@isc.org>
List: tech-kern
Date: 01/18/2000 11:47:59
> That's a bit like saying "given the choice between ``a poke in the eye''
> an ``a bullet in the head'' 80% of respondents chose ``a poke in the eye''"

I think it's more like a choice between a poke in the eye and no poke
in the eye, actually, but I too find it somewhat amusing.   I would
rather have seen them test whether or not people comprehended the code
better with 2- or 4-position tabbing or 8-position tabbing.

> I used to use two spaces, but have used TABs (at 8 spaces naturally)
> for many years and find it better - for many of the reasons that Paul Vixie
> cited.  Emacs can generate almost any sane layout style automagically
> so I'm not particularly fussed - but I suspect 2 is a bad idea.

The real problem with 8-position tabbing is that it virtually requires
you to use terse variable and function names.   Some people like
that.   Personally, I find it annoying, because it means I have to
keep things in my head that don't need to be in my head.   So I'd
rather code like this:

void check_for_error (parse)
     struct parse *parse;
{
  if (parse -> error_code != success)
    {
       parse_error_count++;
    }
}

Than:

void cfe (p)
     struct prs *p;
{
	if (p->err != OK) {
		++errs;
	}
}

The reason for the tradeoff I describe above doesn't get obvious until
you have two more levels of nesting, but if you do have two more
levels of nesting, you quickly get to the point where you're coding
like this:

							check_for_error (
								current_parse);

instead of

			    check_for_error (current_parse);

Yes, that's seven levels of indents, but if you try to do goto-less
programming, it's _very_ easy to get to seven levels of indents - two
loops and a couple of conditionals and you're whacked up against the
right margin, doing one line per variable.   Yuck.

			       _MelloN_