Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Feb 1996 18:32:42 -0800
From:      "Jordan K. Hubbard" <jkh@time.cdrom.com>
To:        invalid opcode <coredump@nervosa.com>
Cc:        freebsd-chat@freebsd.org
Message-ID:  <7397.825561162@time.cdrom.com>
In-Reply-To: Your message of "Wed, 28 Feb 1996 16:51:43 PST." <Pine.BSF.3.91.960228164926.21883C-100000@nervosa.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> This is from /usr/src/linux/Documentation/CodingStyle, it's Linus' own 
> personal coding style. Am I the only one here who finds this, ultimate 

I suppose..  I don't know, there are a few things he says which I
agree with and a few I don't.  I like 4 column tabs and think that 8
is just a waste of screen real-estate.  I have no problem seeing the
indentation levels with 4 column offsets and can only conclude that
Linus needs glasses on that one.  As to multiple levels of
indentation, I personally like to set my limit at 4 before I start
looking at the loop or if chain suspiciously, but that's just me.  If
somebody else likes 6 or 8, WTF..  I do agree with Linus that the K&R
formatting standards are the One True Way, however, and still use them
to this day.  I figure it's the book that taught most/all of us to
program in C, and if we emulate its style then we can at least read
eachother's code without barfing up long segments of intestine.  Well,
that's in theory, anyway.  If we're yawning in technicolor, it at
least won't be from the indentation.  I've seen code that I had to run
through indent just to be able to *parse* it correctly, and that's no
fun.

The bit about functions spanning no more than 2 screens isn't even
really Linus's doctrine, either - you'll find that point of view
expoused in a number of C++ books when talking about determining the
proper balance of abstraction.

For what it's worth, I too find that the demands imposed by keeping
most functions below 2 pages has a good effect on my overall program
design.  Where I might ordinarily just write out a procedure linearly
to save time, I'm forced to break the problem at some reasonable point
and create another level of logical abstraction.  Conversely, when my
functions start getting only 3 and 4 lines long as a general rule, I
know I've gone out of control and need to stop with the friggin'
abstraction already! :-)

					Jordan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7397.825561162>