Call a function from a group of different argument lists with out switch statement

Posted on 2002-04-10
Last Modified: 2010-04-02
Here I am having three lists

1)Pointer to Functions (Functions are of variable arguments and different argument types)
2)Argument Type List
3)Arguments received( Received in a buffer, In this we are not receiving any argument type. It is a block of data)

From this I need initialize the arguments and assing the data received in 3 and call the function with these initialized argumnets.
One way is switch case depends on function type.
This will consume lot of memory.

Another way is push the received data onto the stack depends on the srgument type and call the function(This nneds assemly language and not user friendly).
If any other Idea..Please ....

Thanks in advance,
Question by:klkreddy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 6933010
If you're trying to implement RPC I'd suggest first looking into existinggmechanisms. RPC isn't trivial.

Author Comment

ID: 6934338
I want to implement the RPC with out XDR.So I am struggling this much.
LVL 22

Accepted Solution

ambience earned 200 total points
ID: 6941130
not sure though what exactly the situation is but ..

how about calling the function by pointers indexed by function type.

like say g_func is an array of pointer to functions.

so instead of a switch you index into the array using the function type or id.

(g_func[ function_tpe ])(args...);

this doesnt require assembly to manipulate stack too. Provided you have function ids for all the function callable.

Please post further information incase i havent understood the problem.
LVL 11

Expert Comment

ID: 7012034
Dear klkreddy

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept


comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is:


Author Comment

ID: 7015530
Hi Ambience,
          Thanks for suggesting me the suitable answer.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question