Solved

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

Posted on 2002-04-10
5
164 Views
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,
klkreddy
0
Comment
Question by:klkreddy
5 Comments
 
LVL 4

Expert Comment

by:AssafLavie
Comment Utility
If you're trying to implement RPC I'd suggest first looking into existinggmechanisms. RPC isn't trivial.
0
 

Author Comment

by:klkreddy
Comment Utility
I want to implement the RPC with out XDR.So I am struggling this much.
0
 
LVL 22

Accepted Solution

by:
ambience earned 200 total points
Comment Utility
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.
0
 
LVL 11

Expert Comment

by:griessh
Comment Utility
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

     "ambience"

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: http://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 

Author Comment

by:klkreddy
Comment Utility
Hi Ambience,
          Thanks for suggesting me the suitable answer.
Regards,
klkreddy
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now