[TUHS] margins and indenting, and arbitrary c rules

Noel Chiappa jnc at mercury.lcs.mit.edu
Fri Nov 10 01:31:51 AEST 2017

    > I'd been moving in this direction for a while

Now that I think about it, I may have subconciously absorbed this from Ken's
and Dennis' code in the V6 kernel. Go take a look at it: more than one level
of indent is quite rare in anything there (including tty.c, which has some
pretty complex stuff in it).

I don't know if this was subconcious but deliberate, or concious, or just
something they did for other reasons (e.g. typing long lines took too long on
their TTY's :-), but it's very noticeable, and consistent.

It interesting that both seem to have had the same style; tty.c is in dmr/, so
presumably Dennis', but the stuff in ken/ is the same way.

Oh, one other trick for simplifying code structure (which I noticed looking
through the V6 code a bit - this was something they _didn't_ do in one place,
which I would have done): if you have

	if (<condition>) {
		<some complex piece of code>
	<implicit return>

invert it:

	if (<!condition>)

	<some complex piece of code>

That gets that whole complex piece of code down one level of nesting.


More information about the TUHS mailing list