How to redirect variadic function parameters?

Bill Baxter dnewsgroup at
Sun Feb 18 16:04:47 PST 2007

Mikko wrote:
> In case I have
> void foo(...) {}
> void bar(...) {}
> how should I call bar from foo and passing along all the parameters?
> void foo(...) { bar(?); } // bar(...) doesn't work
> thanks, Mikko

You have to create a different, non-variadic function that takes 
_arguments and _argptr as arguments.

See for example writefx in phobos/std/stdio.d:
    void writefx(FILE* fp,
                 TypeInfo[] arguments, void* argptr,
                 int newline=false);

Or use variadic templates, which can be passed from one function to another.


More information about the Digitalmars-d-learn mailing list