From: Werner Almesberger <wa@almesberger.net>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Larry McVoy <lm@bitmover.com>,
davej@redhat.com, torvalds@osdl.org,
linux-kernel@vger.kernel.org, dri-devel@lists.sourceforge.net
Subject: Re: [PATCH] CodingStyle fixes for drm_agpsupport
Date: Tue, 12 Aug 2003 07:00:07 -0300 [thread overview]
Message-ID: <20030812070007.A8269@almesberger.net> (raw)
In-Reply-To: <3F37D80D.5000703@pobox.com>; from jgarzik@pobox.com on Mon, Aug 11, 2003 at 01:53:17PM -0400
Jeff Garzik wrote:
> Also, having two styles
> of 'if' formatting in your example just screams "inconsistent" to me :)
Naw, it's only one style:
<stmt> ::= if (<expression>) <stmt>
<stmt> ::= { <newline> <stmts> } <newline>
<stmt> ::= <expression> ; <newline>
etc.
Perfectly consistent. ("Always end a statement with a newline.")
> Ug. The first and last 'if' need spreading out away from the big fat
> block,
Why waste a perfectly good punch card on that second line ? :-)
My own formatting rules for "if" go about like this:
1) if "if" and the statement fit on a single line, put them accordingly
("vertical space is precious")
2) if the line needs to wrap (I wrap at the 79th column), always put
the statement on a separate line, fully indented ("wrap at the
highest hierarchical level")
3) likewise for "else" and statement. Here, 2) doesn't apply for kernel
code, which uses a full tab for indentation - in my user-space code,
I use only four spaces, so sometimes, I get
else
stuff_that_just_happens_to_be_too_long_by_one_silly_little_character();
4) if the statement is a block, and there is an "else" branch with a
single statement, invert the condition ("don't hide the fine print")
Since I'm the only sentient being in the universe, and all the rest
of you are just figments of my imagination, it's fairly obvious that
my style is The Right Style :-)
> and the "return (whatever)" fools your eyes into thinking they
> are function calls at a 10-nanosecond glance.
Yeah, I hate that too.
Larry:
> > I also make people do
> >
> > if ((a <= B) || (c >= d)) {
Argl. That's one place where the precedence works beautifully.
Extra parentheses in trivial cases always make me suspect that
the author was actually trying to do something else.
- Werner
--
_________________________________________________________________________
/ Werner Almesberger, Buenos Aires, Argentina wa@almesberger.net /
/_http://www.almesberger.net/____________________________________________/
next prev parent reply other threads:[~2003-08-12 10:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-11 15:59 davej
2003-08-11 16:40 ` Larry McVoy
2003-08-11 16:58 ` Jeff Garzik
2003-08-11 17:04 ` Larry McVoy
2003-08-11 17:15 ` Jeff Garzik
2003-08-11 17:23 ` Larry McVoy
2003-08-11 17:53 ` Jeff Garzik
2003-08-11 17:59 ` Larry McVoy
2003-08-11 18:11 ` Jeff Garzik
2003-08-11 19:09 ` [Dri-devel] " Philip Brown
2003-08-12 12:07 ` Peter "Firefly" Lund
2003-08-12 10:00 ` Werner Almesberger [this message]
2003-08-13 19:44 ` Jamie Lokier
2003-08-14 14:21 ` Eli Carter
2003-08-14 14:47 ` Larry McVoy
2003-08-14 15:18 ` Eli Carter
2003-08-14 15:28 ` Larry McVoy
2003-08-14 19:01 ` Gene Heskett
2003-08-14 18:43 ` [Dri-devel] " Philip Brown
2003-08-14 18:59 ` Randy.Dunlap
2003-08-14 20:16 ` Larry McVoy
2003-08-14 20:21 ` Eli Carter
2003-08-14 20:22 ` Larry McVoy
[not found] <jnSd.6CM.1@gated-at.bofh.it>
[not found] ` <jo20.6MB.31@gated-at.bofh.it>
[not found] ` <jouY.7jw.9@gated-at.bofh.it>
[not found] ` <jov3.7jw.37@gated-at.bofh.it>
[not found] ` <joEI.7s9.9@gated-at.bofh.it>
[not found] ` <joOj.7Aj.11@gated-at.bofh.it>
[not found] ` <jphi.85s.1@gated-at.bofh.it>
[not found] ` <jphn.85s.17@gated-at.bofh.it>
2003-08-12 9:52 ` Ed Cogburn
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=20030812070007.A8269@almesberger.net \
--to=wa@almesberger.net \
--cc=davej@redhat.com \
--cc=dri-devel@lists.sourceforge.net \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lm@bitmover.com \
--cc=torvalds@osdl.org \
/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
Powered by JetHome