lkml.org 
[lkml]   [2009]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch] tty: move a definition out of switch block
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.


\
 
 \ /
  Last update: 2009-12-03 09:37    [W:1.283 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site