Subject: Re: Time to update KNF?
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 01/19/2000 15:21:25
> Again, the best solution is probably to have an editor that formats
> to your preference upon loading and reformats to KNF on output. If
> that's possible to do properly.
It's not, really, because it - or any mechanical reformatting, for that
matter - destroys violations of the rules that improve readbility.
And yes, such things exist. Consider as a simple example
else if (!strcmp(*av,"-debug"))
{ WANTARG();
if (!strcasecmp(av[skip],"none")) plevel = P_NONE;
else if (!strcasecmp(av[skip],"warn")) plevel = P_WARN;
else if (!strcasecmp(av[skip],"note")) plevel = P_NOTE;
else if (!strcasecmp(av[skip],"info")) plevel = P_INFO;
else if (!strcasecmp(av[skip],"debug")) plevel = P_DEBUG;
else
{ ...error handling here...
}
continue;
}
versus what you get if you run that inner if construct through anything
mechanical. At the very least it will destroy the alignment of the
then-clauses (which in this case is perhaps not a big deal, but I have
written cases where making everything line up makes a big difference; I
just couldn't find one in thirty seconds or so). It'll also pull the
first if over to the left, thereby obscuring the parallel structure
even more.
der Mouse
mouse@rodents.montreal.qc.ca
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B