Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2002-04-10
Medium Priority
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 600 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

688 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