digitalmars.D.learn - D(...) to call another D(...)
- James Dunne (11/11) May 22 2005 Being a relatively old-timer with D, I feel slightly embarassed about as...
- Denis R (9/24) May 22 2005 Can you actually do this in D ?
- Kris (11/22) May 22 2005 There has to be a target method/function signature along the following
- Denis R (3/36) May 22 2005 nice
- Lionello Lunesu (9/10) May 23 2005 Maybe this can be changed to use the newly added Box?
- David L. Davis (54/65) May 22 2005 James, I know this isn't exactly what you asked for, but since you're go...
-
Stewart Gordon
(8/13)
May 23 2005
Being a relatively old-timer with D, I feel slightly embarassed about asking
this, but I humbly submit:
How does one call a variadic-function in D with the variadic arguments presented
to the calling function?
: int error_log(...) {
: return writef(...);
: }
I seem to have tried all variants of passing combinations of _argptr, _arguments
along, with no success.
Regards,
James Dunne
May 22 2005
Can you actually do this in D ?
In C you woudnt, unless writef has from writef(va_list ap)
error_log(...)
{
writef(va_list ap);
}
:$
On Sun, 22 May 2005 19:34:16 +0000 (UTC)
James Dunne <james.jdunne gmail.com> wrote:
Being a relatively old-timer with D, I feel slightly embarassed about asking
this, but I humbly submit:
How does one call a variadic-function in D with the variadic arguments
presented
to the calling function?
: int error_log(...) {
: return writef(...);
: }
I seem to have tried all variants of passing combinations of _argptr,
_arguments
along, with no success.
Regards,
James Dunne
May 22 2005
There has to be a target method/function signature along the following lines: This will accept the implicit parameters _arguments and _argptr of the calling function. I expect std.format does something like this. - Kris "James Dunne" <james.jdunne gmail.com> wrote in message news:d6qmro$2eh2$1 digitaldaemon.com...Being a relatively old-timer with D, I feel slightly embarassed aboutaskingthis, but I humbly submit: How does one call a variadic-function in D with the variadic argumentspresentedto the calling function? : int error_log(...) { : return writef(...); : } I seem to have tried all variants of passing combinations of _argptr,_argumentsalong, with no success. Regards, James Dunne
May 22 2005
nice On Sun, 22 May 2005 14:21:44 -0700 "Kris" <fu bar.com> wrote:There has to be a target method/function signature along the following lines: This will accept the implicit parameters _arguments and _argptr of the calling function. I expect std.format does something like this. - Kris "James Dunne" <james.jdunne gmail.com> wrote in message news:d6qmro$2eh2$1 digitaldaemon.com...Being a relatively old-timer with D, I feel slightly embarassed aboutaskingthis, but I humbly submit: How does one call a variadic-function in D with the variadic argumentspresentedto the calling function? : int error_log(...) { : return writef(...); : } I seem to have tried all variants of passing combinations of _argptr,_argumentsalong, with no success. Regards, James Dunne
May 22 2005
Maybe this can be changed to use the newly added Box? void format( Box[] arguments ); Which means: * Box[] can be created implicitely when calling a function with ... : format(2,3,"test") will created a Box[] with 3 elements and passing it to format(...) * a Box[] can be passed to a function for the "..." my_format( ... ) { format(arguments); } L.
May 23 2005
In article <d6qmro$2eh2$1 digitaldaemon.com>, James Dunne says...
Being a relatively old-timer with D, I feel slightly embarassed about asking
this, but I humbly submit:
How does one call a variadic-function in D with the variadic arguments presented
to the calling function?
: int error_log(...) {
: return writef(...);
: }
I seem to have tried all variants of passing combinations of _argptr, _arguments
along, with no success.
Regards,
James Dunne
James, I know this isn't exactly what you asked for, but since you're going to
print the error within the error_log function, it makes sense to me that it
should be formatted and then printed there. So maybe the code I wrote below
might do the job for your current problem.
Output:
---------
C:\dmd>dmd errorlog.d
C:\dmd\bin\..\..\dm\bin\link.exe errorlog,,,user32+kernel32/noi;
C:\dmd>errorlog
error: Found 123.45, was expecting a non-floating point number.
iMsgLen=63
C:\dmd>
Hope you find the code useful,
David L.
-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
-------------------------------------------------------------------
MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
May 22 2005
James Dunne wrote:Being a relatively old-timer with D, I feel slightly embarassed about asking this, but I humbly submit: How does one call a variadic-function in D with the variadic arguments presented to the calling function?<snip> Known issue. http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/11282 Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
May 23 2005









Denis R <denis_r telkomsa.net> 