public inbox for c++-embedded@sourceware.org
 help / color / mirror / Atom feed
From: Ken <shiva@compuserve.com>
To: C++ Embedded <c++-embedded@cygnus.com>
Subject: static function tables
Date: Sat, 27 Jun 1998 01:34:00 -0000	[thread overview]
Message-ID: <3594A08B.6D84@compuserve.com> (raw)

What's the right way to do static tables containing function pointers in
C++?

I have an embedded C app that parses a command from a host and looks it
up in a group of tables. Each table represents an array of related
commands. It contains an 8-byte char[] of the command, a parameter
count, some flags, and a pointer to the function that handles that
command. There are several such tables, linked in based on what feature
set a given app will have.

When I move this app to C++, what's a reasonable OOP-ish way of handling
these tables?

To make command-lookup fast, a table is alphabatized and coded in
assembler (so that I can place labels within the array) and a parallel
26-word array of pointers points to the first command starting with a
given letter. Any suggestions for improvement? A typical table might
have 20-100 commands and an app might have 3-10 tables.

-- 
Ken
mailto:shiva@well.com
mailto:shiva@CompuServe.COM
http://www.well.com/user/shiva/
http://sewnsurf.home.ml.org/
http://www.e-scrub.com/cgi-bin/wpoison/wpoison.cgi (Death to Spam!)





             reply	other threads:[~1998-06-27  1:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-27  1:34 Ken [this message]
1998-06-27  8:40 ` Todd Hoff
1998-06-29 17:27   ` Ken
1998-06-29 19:55     ` Todd Hoff

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=3594A08B.6D84@compuserve.com \
    --to=shiva@compuserve.com \
    --cc=c++-embedded@cygnus.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).