http://d.puremagic.com/issues/show_bug.cgi?id=4172
Fawzi Mohamed <fa...@gmx.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fa...@gmx.ch --- Comment #1 from Fawzi Mohamed <fa...@gmx.ch> 2010-11-24 15:24:32 PST --- The clean way to fix this (and what LDC does) is to pack all arguments (aligning them) in a stack allocated array, create the typeinfo array, and then call the function passing to it a void* to the packed array and the typeinfo array. Thus the D vararg would be equivalent to void*,TypeInfo[]. More explicitly f(...) -> f(void*,TypeInfo[]) This is slightly less efficient than C for some arguments, but is very portable, and one can skip an argument just using typeinfo information (tsize, and possibly alignment). This was the first bug I did encounter when coming to D: I did try to print a complex number and it failed because tango did not explicitly decode a complex. I did add support for some more kinds of hard coded structs to decode, but as nfxjfg says it is impossible to cover all cases on all architectures, as one should cover all possible types at compile time and decode each one with a special va_arg call. The proposed solution is relatively efficient, and portable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------