On Feb 19, 2008 12:42 PM, Kiran Divakaran <[EMAIL PROTECTED]> wrote:

> 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.

That is what varargs are best at. What you want appears to require
something that doesn't use varargs, since they are not suitable for
what you describe.

Without a concrete example of what you're specifically trying to do,
the best I can perhaps suggest is passing around a sentinel terminated
array of structs, with each struct containing a 'variable type' and a
pointer to the variable.

Or my preferred solution - don't require this sort of behaviour;
there's usually more than one way of doing something.

What exactly is the problem that the solution requires 'variable
varargs,' as it were?

-- 
PJH

http://shabbleland.myminicity.com

Reply via email to