On Fri, Mar 18, 2005 at 08:41:52PM +0530, Hong Kong Phoey wrote:
> Sacrificing readibility a little bit, you could do something useful.
> Instead of those ugly switch statements you could define function
> pointer arrays and call appropriate function
> 
> switch(foo) {
> 
>   case 1:
>              f1();
>   case2 :
>              f2();
> };
> 
> could well become
> 
> void (*func)[] = { f1, f2 };
> 
> func(i);

Ewww!

How about sticking with obvious readable code rather than trying to save
a couple of conditional branches.  If it is an obvious good
optimization, let the compiler do it.  of course if you ever needed to
pass different parameters to f1 and/or f2 it would have to be rewritten
back to the original again.

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

Reply via email to