All of lore.kernel.org
 help / color / mirror / Atom feed
From: bdowning@lavos.net (Brian Downing)
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Shawn Bohrer <shawn.bohrer@gmail.com>,
	gitster@pobox.com, git@vger.kernel.org
Subject: Re: [PATCH] Make git-clean a builtin
Date: Wed, 7 Nov 2007 14:51:01 -0600	[thread overview]
Message-ID: <20071107205101.GE6212@lavos.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0711071501270.4362@racer.site>

On Wed, Nov 07, 2007 at 03:04:52PM +0000, Johannes Schindelin wrote:
> I do count them.  Personally, I find it highly distracting and ugly.  
> Besides, we have the convention of putting the "}" not into the same line 
> as "else".  (See keyword "uncuddling" in the list archives.)

I was under the impression that Git followed the kernel coding standards,
which seem to want "cuddled" else statements:

136 Note that the closing brace is empty on a line of its own, _except_ in
137 the cases where it is followed by a continuation of the same statement,
138 ie a "while" in a do-statement or an "else" in an if-statement, like
139 this:
140 
141         do {
142                 body of do-loop
143         } while (condition);
144 
145 and
146 
147         if (x == y) {
148                 ..
149         } else if (x > y) {
150                 ...
151         } else {
152                 ....
153         }
154 
155 Rationale: K&R.

Searching the MARC list archives for "uncuddling" only yields the message
I am replying to.

In addition, the kernel style seems to want braces for all branches of
a conditional if any branch needs it:

163 Do not unnecessarily use braces where a single statement will do.
164 
165 if (condition)
166         action();
167 
168 This does not apply if one branch of a conditional statement is a single
169 statement. Use braces in both branches.
170 
171 if (condition) {
172         do_this();
173         do_that();
174 } else {
175         otherwise();
176 }

This makes sense (to me), as at most you're only adding one extra line
for the final closing brace, and it makes the whole conditional look more
"balanced", IMHO.

But regardless, whatever the actual style for Git should be followed.
Life's too short for arguments about coding style (even if divergence
from K&R brace style is just plain wrong.  :)

-bcd

  reply	other threads:[~2007-11-07 20:51 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07  5:18 [PATCH] Make git-clean a builtin Shawn Bohrer
2007-11-07 11:10 ` Johannes Schindelin
2007-11-07 13:29   ` Bill Lear
2007-11-07 14:17     ` Johannes Schindelin
2007-11-07 14:45     ` Matthieu Moy
2007-11-07 19:46     ` Jon Loeliger
2007-11-10 22:43     ` Miles Bader
2007-11-07 14:54   ` Shawn Bohrer
2007-11-07 15:04     ` Johannes Schindelin
2007-11-07 20:51       ` Brian Downing [this message]
2007-11-07 21:49         ` Junio C Hamano
2007-11-07 20:42 ` Junio C Hamano
2007-11-08  5:37   ` Shawn Bohrer
  -- strict thread matches above, loose matches on Subject: below --
2007-11-12  1:48 Shawn Bohrer
2007-11-04 19:02 [RFC] Second attempt at making " Shawn Bohrer
2007-11-04 19:02 ` [PATCH] Add more tests for git-clean Shawn Bohrer
2007-11-04 19:02   ` [PATCH] Make git-clean a builtin Shawn Bohrer
2007-11-04 19:41     ` Pierre Habouzit
2007-11-05 21:14     ` Junio C Hamano
2007-11-05 22:10       ` Carlos Rica
2007-11-05 23:54         ` Junio C Hamano
2007-11-06  5:05       ` Shawn Bohrer
2007-11-06  5:30         ` Junio C Hamano
2007-10-07 23:57 Shawn Bohrer
2007-10-08  3:57 ` Johannes Schindelin
2007-10-07  1:17 Shawn Bohrer
2007-10-07  1:31 ` Linus Torvalds
2007-10-07 15:41   ` Shawn Bohrer
2007-10-07 16:42     ` rae l
2007-10-07 16:38 ` Johannes Schindelin
2007-10-06 20:54 Shawn Bohrer
2007-10-06 21:52 ` Frank Lichtenheld
2007-10-07  1:13   ` Shawn Bohrer
2007-10-08  2:04 ` Jeff King
2007-10-08  2:08   ` Jeff King
2007-10-08  2:17   ` Linus Torvalds
2007-10-08  2:22     ` Jeff King
2007-10-08  6:37       ` Johannes Sixt
2007-10-08 18:27         ` Linus Torvalds

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=20071107205101.GE6212@lavos.net \
    --to=bdowning@lavos.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=shawn.bohrer@gmail.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.