http://d.puremagic.com/issues/show_bug.cgi?id=5570



--- Comment #25 from klickverbot <c...@klickverbot.at> 2012-06-26 04:48:42 PDT 
---
Sigh – seems like I was not exactly right about how GDC and LDC are handling
arrays. Instead of treating them like the equivalent struct, they are treated
as if length and pointer were two separate arguments, with the important
difference of course being that with the x86_64 ABI, structs are never only
partly passed in registers (i.e., if there is only one register left, they
would still pass the length in it and only push the pointer on the stack).

The LDC x86_64 ABI implementation has had the following explanatory comment
since it was originally written in 2009:

> This helps make things like printf("%.*s", o.toString()) work as expected; if 
> we didn't do this that wouldn't work if there were 4 other integer/pointer 
> arguments before the toString() call because the string got bumped to memory 
> with one integer register still free.

Changing the implementation to treat dynamic arrays/delegates the same as
two-element structs for a potentially easier implementation of va_arg, etc.
wouldn't be a problem, but we need to make a decision and, most importantly,
properly document the expected behavior on dlang.org.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to