How to send variadic arguments
Steven Schveighoffer
schveiguy at yahoo.com
Mon Aug 25 07:27:58 PDT 2008
"Zarathustra" wrote
> How to send variadic arguments to other function?
>
> Of course, I can read each argument by using:
> _argptr is a pointer to arguments list
> _arguments is an array of argument types
>
> But I need to straight send all variadic arguments to other function.
>
> for example:
>
> void func1(char [] o_str, ...){
> }
> void func2(int o_num, ...){
> func2("func2", /* What here? */)
> }
>
The way it is done in Tango is to put the implementation in a function which
takes the _argptr and _arguments as parameters. Then the actual variadic
function is just a wrapper. If you want to chain another variadic function
to it, just pass the _argptr and _arguments.
Passing the argptr and arguments directly really should be a compiler
supported thing, as this is all you are doing anyways. Similar to how you
can call opX directly.
-Steve
More information about the Digitalmars-d-learn
mailing list