Thread: An array of macro functions?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    51

    An array of macro functions?

    I have a program which currently calls functions that are located in an array of function pointers. I have to use this method because there are hundreds of functions and which ones to be called can only be determined at runtime (i.e. by the index it is in the array).

    This is great but is causing a little problem:

    Functions are called rapidly so speed is key. The issue that I have is that the functions being called contain code which are generally only 3-4 lines, so I'm thinking they can truely be macros.

    I would like to use macros instead of functions because functions can be too expensive over time (putting variables on the stack, operating on the return address) etc.... Its just extra code I want to try to avoid, and I don't want the overhead of "calling a function"

    My question is: Is there a way to provide an array of macro functions? I want to try to eliminate calling functions, because im finding that it could be too expensive. Maybe there is a better way to do it?
    Last edited by someprogr; 01-28-2009 at 04:21 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Functions and Array
    By dldsob in forum C++ Programming
    Replies: 2
    Last Post: 07-10-2009, 04:32 PM
  2. Array of Pointers to Functions in Structs...
    By yaya in forum C++ Programming
    Replies: 10
    Last Post: 12-21-2008, 06:14 PM
  3. question about multidimensional arrays
    By richdb in forum C Programming
    Replies: 22
    Last Post: 02-26-2006, 09:51 AM
  4. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 12:09 PM
  5. Array Program
    By emmx in forum C Programming
    Replies: 3
    Last Post: 08-31-2003, 12:44 AM