digitalmars.D.learn - Calling a d-style-variadic-function from another
- tipdbmp (21/21) Dec 30 2017 import core.vararg;
- John Chapman (3/5) Dec 30 2017 Try this:
import core.vararg;
string foo(fmt, ...) {
int args_len = _arguments.length;
if (args_len == 1) {
if (typeid(_arguments[0] == typeid(TypeInfo[]))) {
_arguments = va_arg!(TypeInfo[])(_argptr);
args_len = _arguments.length;
// how can I adjust _argptr?
_argptr = ???
}
}
// using _arguments and va_arg!(X)(_argptr) here
return "not implemented";
}
void writef(string fmt, ...) {
// write(foo(fmt, ...)); // <-- doesn't work
// _arguments gets passed as a single argument of type
TypeInfo[]
write(foo(fmt, _arguments));
}
https://dlang.org/spec/function.html#d_style_variadic_functions
Dec 30 2017
On Saturday, 30 December 2017 at 10:14:35 UTC, tipdbmp wrote:
// how can I adjust _argptr?
_argptr = ???
Try this:
_argptr = *cast(va_list*)_argptr;
Dec 30 2017








John Chapman <johnch_atms hotmail.com>