From: jnc@mercury.lcs.mit.edu (Noel Chiappa)
Subject: [TUHS] margins and indenting, and arbitrary c rules
Date: Thu, 9 Nov 2017 10:31:51 -0500 (EST) [thread overview]
Message-ID: <20171109153151.3801118C0BC@mercury.lcs.mit.edu> (raw)
> 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>)
return;
<some complex piece of code>
}
That gets that whole complex piece of code down one level of nesting.
Noel
next reply other threads:[~2017-11-09 15:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 15:31 Noel Chiappa [this message]
2017-11-10 18:41 ` Ian Zimmerman
-- strict thread matches above, loose matches on Subject: below --
2017-11-09 16:03 Noel Chiappa
2017-11-09 15:09 Noel Chiappa
2017-11-09 15:41 ` Don Hopkins
2017-11-09 19:13 ` Ron Natalie
2017-11-09 8:07 Steve Simon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171109153151.3801118C0BC@mercury.lcs.mit.edu \
--to=jnc@mercury.lcs.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).