Variadic functions: How to pass another variadic function the variadic args?

monarch_dodra monarchdodra at gmail.com
Sat Aug 3 12:32:18 PDT 2013


On Saturday, 3 August 2013 at 19:12:40 UTC, bearophile wrote:
> monarch_dodra:
>
>> My guess though, is that it's the same syntax as in C? Use a 
>> straight up elispis:
>>
>> void foo(...).
>>
>> Note that you *can't* extract the types from the vararg unless 
>> you *guess* them from an alternative source (for example, 
>> "fmt" in the printf function)
>>
>> Also, importing "core.vararg" should get you whatever you'd 
>> get in 'vararg.h'/"stdarg.h". From there, I don't think D does 
>> anything specific that's not actually just C.
>
> D supports both C and D style variadiac functions. D variadiac 
> functions also have a _arguments of type TypeInfo[].
>
> See here about in the middle of the page:
> http://dlang.org/function

The more you know I guess. Good to see D made the whole thing 
more robust. I've never had a usecase for runtime variadic, but 
thanks for the link.



More information about the Digitalmars-d-learn mailing list