From: lsorense@csclub.uwaterloo.ca (Lennart Sorensen)
To: Hong Kong Phoey <hongkongphoey@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] DM9000 network driver
Date: Fri, 18 Mar 2005 10:25:54 -0500 [thread overview]
Message-ID: <20050318152554.GH17865@csclub.uwaterloo.ca> (raw)
In-Reply-To: <4f6c1bdf0503180711148b8f02@mail.gmail.com>
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
next prev parent reply other threads:[~2005-03-18 15:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-18 13:31 Sascha Hauer
2005-03-18 15:11 ` Hong Kong Phoey
2005-03-18 15:25 ` Lennart Sorensen [this message]
2005-03-18 15:55 ` John W. Linville
2005-03-18 16:02 ` Dmitry Torokhov
2005-03-18 16:04 ` linux-os
2005-03-18 16:21 ` Alan Cox
2005-03-18 16:58 ` Ben Dooks
2005-03-18 17:29 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050318152554.GH17865@csclub.uwaterloo.ca \
--to=lsorense@csclub.uwaterloo.ca \
--cc=hongkongphoey@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®