Problem with function taking variable number of arguments with -m64

tipdbmp email at example.com
Fri Jan 12 04:23:28 UTC 2018


//
// rdmd -m64 foo.d
//
module va_arg_x64_windows;

void foo(void* a, void* b, void *c, void* d, ...) {
     import core.vararg : va_arg;
     import std.stdio : writeln;

     foreach (arg; _arguments) {
         if (arg == typeid(int)) {
             int x = va_arg!(int)(_argptr);
             writeln("x: ", x);
         }
         //else {
         //    writeln("unknown arg type: ", arg.toString());
         //}
     }
}

void main() {
     foo(null, null, null, null, 1234, 5678);
     // expected:
     //     x: 1234
     //     x: 5678
     // output:
     //     x: 0
     //     x: 1234
}



More information about the Digitalmars-d-learn mailing list