public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: Alan Cox <alan@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Joe Peterson <joe@skyrush.com>
Subject: Re: [Patch] tty: move a definition out of switch block
Date: Thu, 03 Dec 2009 16:36:08 +0800	[thread overview]
Message-ID: <4B177878.2090002@redhat.com> (raw)
In-Reply-To: <20091201154412.4002a0d8@linux.intel.com>

Alan Cox wrote:
> On Tue, 1 Dec 2009 02:54:44 -0500
> Amerigo Wang <amwang@redhat.com> wrote:
> 
>> It's not good to leave a definition between 'switch'
>> and its first label. Move it out of the switch block.
> 
> "Not good". On what basis is it not good to put variables local to
> their scope ?
> 

Hello, Alan,

Generally putting variables local in the local scope is fine, but
not for 'switch' block, to be more precisely, not for the case
where putting local variables between 'switch' and its _first_
label, IMO.

It can lead to misunderstanding easily, since 'switch'
jumps to its first label at a first glance. I know in this case
the code is _not_ wrong, but again, it's not good for reading.

Also, there's no conflicts if we put it out of 'switch' block.

Thanks.

  reply	other threads:[~2009-12-03  8:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01  7:54 [Patch] tty: move a definition out of switch block Amerigo Wang
2009-12-01 15:44 ` Alan Cox
2009-12-03  8:36   ` Cong Wang [this message]
2009-12-03 11:13     ` Alan Cox
2009-12-08 10:10       ` Cong Wang
2009-12-08 15:02         ` Joe Peterson
2009-12-03 15:18     ` Joe Peterson

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=4B177878.2090002@redhat.com \
    --to=amwang@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=gregkh@suse.de \
    --cc=joe@skyrush.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox