DMD Phobos 到 Tango 的转换:va_arg - 它是什么?我用什么来代替它?
我正在尝试将一些 Phobos 代码转换为其 Tango 等效项,但我被这段我不完全理解的代码所困扰:
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));
}
}
特别是 va_arg 导致了错误:
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
有人能够分享一些关于如何解决这个问题吗? :-)
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? :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您根本不需要更换它。只需导入tango.core.Vararg;
或者,如果这不起作用,请尝试 tango.stdc.stdarg;
另请参阅 http://dsource.org/projects 中的相应文档/tango/docs/current/tango.stdc.stdarg.html
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
查看http://d-programming-language.org/phobos/core_vararg.html
check out http://d-programming-language.org/phobos/core_vararg.html