Re: [PATCH] DM9000 network driver

From: Dmitry Torokhov
Date: Fri Mar 18 2005 - 11:15:31 EST


On Fri, 18 Mar 2005 10:25:54 -0500, Lennart Sorensen
<lsorense@xxxxxxxxxxxxxxxxxxx> wrote:
> 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.

On top of that I highly doibt that setting up stack frame for an
indirect function call is less expensive than a conditional branch.

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