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

bearophile bearophileHUGS at lycos.com
Sat Aug 3 12:12:38 PDT 2013


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

(This is why we ask people like JS "why do you need that?", 
because very often there are better solutions if you know the 
real problem to solve).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list