From: Larry McVoy <lm@bitmover.com>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: Emiliano Gabrielli <emiliano.gabrielli@roma2.infn.it>,
linux-kernel@vger.kernel.org
Subject: Re: Indention - why spaces?
Date: Mon, 30 Dec 2002 22:04:59 -0800 [thread overview]
Message-ID: <20021231060459.GA15558@work.bitmover.com> (raw)
In-Reply-To: <200212310528.gBV5Sbn29105@devserv.devel.redhat.com>
On Tue, Dec 31, 2002 at 12:28:37AM -0500, Pete Zaitcev wrote:
> > IMHO and in my personal projects I use the following indenting rules:
> >
> > 1) use TABs for _indentation_
> > 2) use SPACEs for aligning
> >
> > here is an exaple:
> >
> ><tab><tab>if (cond) {
> ><tab><tab><tab>dosometing;
> ><tab><tab><tab>printf("This is foo: '%s', and this bar: '%d'",
> ><tab><tab><tab> foo, bar);
>
> BTW, this practice is codified in Solaris developer's guidelines.
> They even have a perl script called "hdrchk" which is run before
> commits and tells about violations. Actually, the Sun requirement
> is to have exactly 4 spaces, but it sounds a little too anal to me.
Indeed and the reasoning is that tabs are for indentation, 4 spaces are
for continuation lines.
if (expr) {
statement;
statement;
if (really_long_expression && another_expression &&
one_more) {
statement;
}
}
You can do slightly better than that if you do it like this:
if (really_long_expression &&
another_expression && one_more) {
statement;
}
I try and get people to put the longer part of the expression on the
continuation line, your eyes will parse that better than the first way.
By the way, this sort of thing is a big deal around here, I spend a
lot of time getting people to do it all the same way. It's worth it.
The bottom line is "can I fix bugs in your code quickly?". Indentation
is part of understanding the code.
--
---
Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
next prev parent reply other threads:[~2002-12-31 5:56 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.f9m4suv.e6ubgf@ifi.uio.no>
2002-12-30 3:33 ` Indention - why spaces? Russ Allbery
2002-12-30 3:43 ` Larry McVoy
2002-12-30 3:47 ` john slee
2002-12-30 4:26 ` Russ Allbery
2002-12-30 23:20 ` Mark Mielke
2002-12-30 12:28 ` Wichert Akkerman
2002-12-30 12:49 ` John Bradford
2002-12-30 12:57 ` Wichert Akkerman
2002-12-30 13:12 ` Rik van Riel
2002-12-30 13:16 ` Russell King
2002-12-30 13:17 ` Dave Jones
2002-12-30 18:53 ` Emiliano Gabrielli
2002-12-30 19:00 ` Arnaldo Carvalho de Melo
2002-12-30 19:30 ` Herman Oosthuysen
2002-12-30 9:42 ` Zac Hansen
2002-12-30 20:43 ` Felix Domke
2002-12-30 23:26 ` Mark Mielke
2002-12-31 1:02 ` Wichert Akkerman
2002-12-30 23:55 ` Herman Oosthuysen
2002-12-31 2:20 ` Anthony J. Breeds-Taurima
2002-12-31 9:47 ` Christoph Hellwig
[not found] ` <mailman.1041274740.23755.linux-kernel2news@redhat.com>
2002-12-31 5:28 ` Pete Zaitcev
2002-12-31 6:04 ` Larry McVoy [this message]
2002-12-30 16:12 ` Larry McVoy
2002-12-31 22:43 Heater, Daniel (IndSys, GEFanuc, VMIC)
-- strict thread matches above, loose matches on Subject: below --
2002-12-31 17:21 Roberto Peon
2002-12-30 2:29 Felix Domke
2002-12-30 11:28 ` Christoph Hellwig
2002-12-31 8:55 ` Tomas Szepe
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=20021231060459.GA15558@work.bitmover.com \
--to=lm@bitmover.com \
--cc=emiliano.gabrielli@roma2.infn.it \
--cc=linux-kernel@vger.kernel.org \
--cc=zaitcev@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.