Suspicous code in kdelibs-3.5.2

Oswald Buddenhagen ossi at kde.org
Sat Apr 8 15:15:07 BST 2006


On Sat, Apr 08, 2006 at 09:06:46AM -0400, Michael Pyne wrote:
> Just a comment acknowledging that the developer knows that code execution 
> will "fall through" into the next case.
> 
> e.g.
> 
> switch (num) {
>   case 1: blah();
>   break;
> 
>   case 2:
>     // Fall through
>   case 3: blah_blah();
> }
> 
that's a bad example, as the intention is pretty obvious and trying to
make it more explicit makes big multi-value just less readable:

switch (foo) {
case 1:
	// Fall through
case 2:
	// Fall through
case 3:
	// Fall through
case 4:
	do_one();
	break;
case 5:
	do_two();
	break;
defualt:
	do_three();
	break;
}

a valid case (i.e., with a non-empty case):

switch (foo) {
case 1:
	do_one();
	// fall through
case 2:
	do_two();
	break;
}

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.




More information about the kde-core-devel mailing list