variadic args

JohnC johnch_atms at hotmail.com
Fri Dec 8 03:08:19 PST 2006


"Anders F Björklund" <afb at algonet.se> wrote in message 
news:elbfah$2u9i$1 at digitaldaemon.com...
> JohnC wrote:
>
>> This is what I do:
>>
>> import std.stdarg;
>>
>> void resolveArgs(inout TypeInfo[] arguments, inout void* argptr) {
>>   if (arguments.length == 2 && arguments[0] is typeid(TypeInfo[]) && 
>> arguments[1] is typeid(void*)) {
>>     arguments = va_arg!(TypeInfo[])(argptr);
>>     argptr = *cast(void**)argptr;
>>
>>     if (arguments.length == 2 && arguments[0] is typeid(TypeInfo[]) && 
>> arguments[1] is typeid(void*))
>>         resolveArgs(arguments, argptr);
>>   }
>> }
>
> This is not portable to GDC, however. (type of argptr should be va_list)

Oh right, I didn't know that.

>
> Comparing typeids with 'is' doesn't always work but using '==' should...

It should, but doesn't in my experience.

>
> --anders 





More information about the Digitalmars-d-learn mailing list