digitalmars.D.learn - How to redirect variadic function parameters?
- Mikko <mikko dev.null> Feb 18 2007
- Bill Baxter <dnewsgroup billbaxter.com> Feb 18 2007
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> Feb 19 2007
- Robin Allen <r.a3 ntlworld.com> Feb 19 2007
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> Feb 19 2007
- C. Dunn <cdunn2001 gmail.com> Aug 01 2007
In case I have
void foo(...) {}
void bar(...) {}
how should I call bar from foo and passing along all the parameters?
void foo(...) { bar(?); } // bar(...) doesn't work
thanks, Mikko
Feb 18 2007
Mikko wrote:In case I have void foo(...) {} void bar(...) {} how should I call bar from foo and passing along all the parameters? void foo(...) { bar(?); } // bar(...) doesn't work thanks, Mikko
You have to create a different, non-variadic function that takes _arguments and _argptr as arguments. See for example writefx in phobos/std/stdio.d: void writefx(FILE* fp, TypeInfo[] arguments, void* argptr, int newline=false); Or use variadic templates, which can be passed from one function to another. --bb
Feb 18 2007
Bill Baxter wrote:You have to create a different, non-variadic function that takes _arguments and _argptr as arguments. See for example writefx in phobos/std/stdio.d: void writefx(FILE* fp, TypeInfo[] arguments, void* argptr, int newline=false);
The portable version uses "std.stdarg.va_list" instead: void writefx(FILE* fp, TypeInfo[] arguments, va_list argptr, int newline=false); Should be the same for DMD, but is a built-in for GDC. (need to use va_arg, instead of pointer manipulations) --anders http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Function#PortabilityandVariadicFunctions
Feb 19 2007
Anders F Björklund wrote:Bill Baxter wrote:You have to create a different, non-variadic function that takes _arguments and _argptr as arguments. See for example writefx in phobos/std/stdio.d: void writefx(FILE* fp, TypeInfo[] arguments, void* argptr, int newline=false);
The portable version uses "std.stdarg.va_list" instead: void writefx(FILE* fp, TypeInfo[] arguments, va_list argptr, int newline=false); Should be the same for DMD, but is a built-in for GDC. (need to use va_arg, instead of pointer manipulations) --anders http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Function#Portability ndVariadicFunctions
Is there any reason why bar(...) couldn't be implemented? It's a mich nicer syntax.
Feb 19 2007
"Robin Allen" <r.a3 ntlworld.com> wrote in message news:erd25h$li1$2 digitalmars.com...Is there any reason why bar(...) couldn't be implemented? It's a mich nicer syntax.
I think we had a topic on this not much more than a week ago, and came to much the same conclusion.
Feb 19 2007
--anders
Your link does not work. Software error: File-Open-Fehler (/usr/home/wikise/wiki/slurp/163.181.251.9.rl): Disc quota exceeded at /usr/local/etc/httpd/htdocs/prowiki/wiki.cgi line 5351. ----------- Anyway, I need to do this too, but my real question is: How do I turn off dout buffering? Otherwise, I need to redirect writefln(...) to fwritefln(derr,...).
Aug 01 2007









"Jarrett Billingsley" <kb3ctd2 yahoo.com> 