lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B1E2626.9010005@redhat.com>
Date:	Tue, 08 Dec 2009 18:10:46 +0800
From:	Cong Wang <amwang@...hat.com>
To:	Alan Cox <alan@...ux.intel.com>
CC:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Joe Peterson <joe@...rush.com>
Subject: Re: [Patch] tty: move a definition out of switch block

Alan Cox wrote:
>> 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.
> 
> So this is just your personal preference ? That seems like pointless
> churn, especially given that many other people consider putting the
> variables there is better than
> 
> 	case foo:
> 	{
> 		Blah blah
> 	}
> 	}
> }
> 
> in switches

Well, in C99 6.5.4, it has a very good example to explain this.
See this example:

switch (xxx) {
	int a = 1; //<-- not initialized
	int b; //<-- seems to be skipped, but not
	func(&a); //<-- skipped;
case 1:
	//...
	break;
case 2:
	return a; //<-- uninitialized value;
}


So why not just:

int a = 1, b;
switch (xxx) {
case 1:
	// blah blah
}

? A first galance will know everything, no need to guess if
'switch' skips it or not.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ