Pass _arguments to next method?
Benjamin Schulte
Aldoric at gmx.de
Fri Jul 4 03:56:44 PDT 2008
I already did so, and I did again as you said. But I can't find the solution for my problem. I can not do something like:
switch( _arguments.length ) {
case 0: call_sum( ); break;
case 1: call_sum( va_arg!(int)(_argptr)) ); break;
case 2: call_sum( va_arg!(int)(_argptr)), va_arg!(int)(_argptr)) ); break;
case 3: call_sum( va_arg!(int)(_argptr)), va_arg!(int)(_argptr)), va_arg!(int)(_argptr)) ); break;
}
That would be too crazy as far that I don't even know the type of the arguments that are passed. I just want to copy the current argument list of the current called method to the next one.
call_sum( _arguments ); // would only pass ONE argument
call_sum( _argptr ); // would also only pass ONE argument
call_sum( ... ); // does not work
One solution surely would be to redesign the call_sum method to something like
void call_sum( void* argptr, uint argcnt ) {
/* ... */
}
But isn't it possible a diffent way?
Maybe this is a better example:
void debugln( ... ) {
// save argument data to file
// ...
// display message
writefln( ~arguments~ );
}
TomD Wrote:
> Benjamin Schulte Wrote:
> [...]
>
> http://www.digitalmars.com/d/1.0/function.html
> see the section about variadic functions.
>
> Ciao
> Tom
>
More information about the Digitalmars-d
mailing list