Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DMD Phobos-to-Tango conversion: va_arg - what is it? and what do I replace it with?

Tags:

d

phobos

tango

I'm trying to convert some Phobos code to its Tango equivalent, but I am stuck on this piece of code that I don't completely understand:

OutBuffer codebuf;

(...)

void gen(Loc loc, uint opcode, uint argc, ...)
{
    codebuf.reserve((1 + argc) * uint.sizeof);
    codebuf.write(combine(loc, opcode));
    for (uint i = 1; i <= argc; i++)
    {
        codebuf.write(va_arg!(uint)(_argptr));
    }
}

It's va_arg in particular that causes the error:

dmdscript_tango\irstate.d(215): Error: undefined identifier va_arg
dmdscript_tango\irstate.d(215): Error: function expected before (), not va_arg of type int

Is anyone able to share some insights into how to get around this problem? :-)

like image 830
Frederik Avatar asked Nov 30 '25 23:11

Frederik


1 Answers

You don't need to replace it at all. Just import tango.core.Vararg;

Or, if that doesn't work, try tango.stdc.stdarg;

See also the according documentation at http://dsource.org/projects/tango/docs/current/tango.stdc.stdarg.html

like image 73
Marenz Avatar answered Dec 02 '25 14:12

Marenz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!