On 5 January 2015 at 09:23, Daniel Murphy via Digitalmars-d <[email protected]> wrote: > "Iain Buclaw via Digitalmars-d" wrote in message > news:[email protected]... > >> void foo(int bar, ...) >> { >> va_list* va = void; >> va_list[1] __va_argsave; >> va = &__va_argsave; >> >> ... >> } >> >> The above being compiler generated by DMD. > > > Should that be va = &__va_argsave[0] ?
Yes. More or less, both should do the same. :-) > So what _should_ DMD be generating? That depends on how we agree to go forward with this. From memory, we each do / did things differently. I have no doubt that the way I've done it is a kludge at best, but I'll explain it anyway. GDC *always* uses the real va_list type, our type-strict backend demands at least that from us. So when it comes down to the problem of passing around va_list when it's a static array (extern C expects a ref), I rely on people using core.vararg/gcc.builtins to get the proper __builtin_va_list before importing modules such as core.stdc.stdio (printf and friends) - as these declarations are then rewritten by the compiler from: int vprintf(__builtin_va_list[1] va, in char* fmt, ...) to: int vprintf(ref __builtin_va_list[1] va, in char* fmt, ...) This is an *esper* workaround, and ideally, I shouldn't be doing this...
