Subject: Re: Cardbus
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 12/22/1999 12:48:21
> If you're just talking about syntactic style (indentation, braces,
> whitespace), then there's not really such thing as a "good" coding
> style versus a "bad" one,

Though this is often said, I think I disagree with it.

Consider the following, which is the NetBSD echo.c reformatted in some
fairly trivial `whitespace' ways:

  int main(argc, argv) int
        char *argv[];
{ int nflag;
/* This utility may NOT do getopt(3) option parsing. */
        if (*++argv && !strcmp(*argv, "-n")) { ++argv; nflag = 1;
                        } else nflag
        = 0;
        while (*argv) {
    (void)printf("%s", *argv);
        if (*++argv)
(void)putchar(' ');
} if (!nflag) (void)putchar('\n'); exit(0);
        /* NOTREACHED */

I think even the most diehard of the "indentation relativists" would
agree this is a *bad* layout style.  This is admittedly a somewhat
contrived example, but I have seen code written by novice (I hope!)
coders that exhibits similar horrors.

People can and do argue endlessly over whether Whitesmiths style is
better or worse than K&R style is better or worse than GNU style is
better or worse than whatever.  But those styles all have one thing in
common: they are internally consistent.  A statement nested in a
certain way is indented by an amount that depends only on the way it's
nested.  Braces, when they appear, appear in predictable positions,
given their nesting.  That sort of thing.

It is possible to violate such style and thereby render the result
*more*, not *less* readable, but if you have to ask for a style guide
you probably aren't to the point where your sense of readability and
style is developed enough yet to get away with that.  (Like any rules,
you have to learn these rules thoroughly before you can learn how and
when to break them.)

					der Mouse

		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B