All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Jesper Juhl <jesper.juhl@gmail.com>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bracing the loop in kernel/softirq.c
Date: Fri, 22 Jun 2007 19:54:09 +0400	[thread overview]
Message-ID: <20070622155409.GA8283@cvg> (raw)
In-Reply-To: <467AC8E9.1000605@goop.org>

[Jeremy Fitzhardinge - Thu, Jun 21, 2007 at 11:52:25AM -0700]
> Jesper Juhl wrote:
>> On 20/06/07, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
>>> This trivial patch adds braces over a one-line
>>> loop. That makes code...well... little bit
>>> convenient for (possible) further modifications.
>>>
>> That's generally not done.
>>
>> It's even in Documentation/CodingStyle :
>>
>> "
>> Do not unnecessarily use braces where a single statement will do.
>>
>> if (condition)
>>        action();
>> "
>
> I tend to see "do {} while()" as an exception to this.  I find the 
> construct is sufficiently rare that it helps to emphasize it a bit.  For 
> example if I'm scanning code and I see:
>
> 	while (foo != NULL);
>
> in the corner of my eye, I'm going to think "huh?".  But:
>
> 	} while (foo != NULL);
>
> visually "parses" properly, regardless of how near or far the corresponding 
> "do  {" is.
>
> (And of course, its consistent with the super extra special while-while 
> loop:
>
> 	while (foo != NULL) {
> 		foo = bar();
> 		piffle();
> 	} while (foo != NULL);	// make sure we loop properly
>
> ;)
>
>    J
>

Btw, Jeremy, could you please Ack it then and I'll resend the patch to Andrew ;)

		Cyrill


  parent reply	other threads:[~2007-06-22 15:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-20 17:57 [PATCH] bracing the loop in kernel/softirq.c Cyrill Gorcunov
2007-06-20 21:01 ` Jesper Juhl
2007-06-21 13:49   ` Cyrill Gorcunov
2007-06-21 17:20     ` Jesper Juhl
2007-06-21 17:32       ` Cyrill Gorcunov
2007-06-21 18:52   ` Jeremy Fitzhardinge
2007-06-21 19:11     ` Cyrill Gorcunov
2007-06-22 15:54     ` Cyrill Gorcunov [this message]
2007-06-22 18:05       ` Jeremy Fitzhardinge

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=20070622155409.GA8283@cvg \
    --to=gorcunov@gmail.com \
    --cc=jeremy@goop.org \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.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 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.