digitalmars.D.learn - How to redirect variadic function parameters?
- Mikko (6/6) Feb 18 2007 In case I have
- Bill Baxter (9/19) Feb 18 2007 You have to create a different, non-variadic function that takes
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (8/15) Feb 19 2007 The portable version uses "std.stdarg.va_list" instead:
- Robin Allen (3/24) Feb 19 2007 Is there any reason why bar(...) couldn't be implemented? It's a mich
- Jarrett Billingsley (4/6) Feb 19 2007 I think we had a topic on this not much more than a week ago, and came t...
- C. Dunn (6/7) Aug 01 2007 http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Function#Portabilitya...
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, MikkoYou 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:Is there any reason why bar(...) couldn't be implemented? It's a mich nicer syntax.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
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
--andershttp://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Function#PortabilityandVariadicFunctions 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