Kiran Divakaran wrote: > Paul, > > Let me rephrase the question is it possible to form the va_list type of > variable programmatically and send it to a function. Else. > > Was interested in knowing how variable arguments can be decided on the fly > and calls made to a function capable of accepting variable arguments. > > Generally we find hard coded calls which pass 1,2,3 ...n of arguments to a > function capable of handling multiple arguments. > > How should the implementation of the function be for which the number of > parameters (dynamic ) that need to be passed to this function be which is > decided at runtime based on program logic. > > How should a multiple arguments function make calls to a function accepting > multiple args . The calling function needs to decide the multiple calling > args at runtime and make a call to multiple arg function. > > Probably this is a asking for a utopian solution . Is it asking for too much > as always the parameters that need to be passed to a multiple arg function > are always known before hand and this situation does not normally arise. > > Regards, > Kiran
Kiran, What _exactly_ are you trying to do? Sounds to me like you are trying to allow the _end-user_ control over the number and types of variables passed to a function. C/C++ are compiled languages. An interpreted language can do what you describe but not compiled languages. Consider, instead, creating a linked list with the user's types, parameters, and values and passing that instead of fiddling with varargs to do something it was not intended to do. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
