digitalmars.D.learn - Passing _arguments into another variadic function
- Satoshi (14/14) Apr 12 2016 Hello, I have a little problem with Variadic functions.
- Steven Schveighoffer (4/16) Apr 12 2016 Tango used to do this (probably still does). I don't remember the
- Adam D. Ruppe (8/10) Apr 12 2016 In C, you would make a version of the function that takes the
Hello, I have a little problem with Variadic functions. I have function like: void perform(string method, ...) { // here I want to call method findMethod with _argptr and _arguments } MethodDesc findMethod(string method, ...) { // some lookup through the tables... } I know there are variadic templates, but I want to use this style of implementation. Is it possible to pass varargs to another function or must I do it by asm? Thanks for help :)
Apr 12 2016
On 4/12/16 5:08 AM, Satoshi wrote:Hello, I have a little problem with Variadic functions. I have function like: void perform(string method, ...) { // here I want to call method findMethod with _argptr and _arguments } MethodDesc findMethod(string method, ...) { // some lookup through the tables... } I know there are variadic templates, but I want to use this style of implementation. Is it possible to pass varargs to another function or must I do it by asm? Thanks for help :)Tango used to do this (probably still does). I don't remember the details, but yes, it is definitely possible. -Steve
Apr 12 2016
On Tuesday, 12 April 2016 at 09:08:06 UTC, Satoshi wrote:Is it possible to pass varargs to another function or must I do it by asm?In C, you would make a version of the function that takes the va_list type (see, for example, vprintf). I believe in D, you'd want to do the same thing. Make another version of your function, one does foo(...) and one does foo(void* argptr, TypeInfo[] argtypes) and to forward the (...) version to the other, you call foo(_argptr, _arguments), which holds the real implementation.
Apr 12 2016