On 05/16/2017 11:35 AM, Kagamin wrote:
On Monday, 15 May 2017 at 10:41:55 UTC, ag0aep6g wrote:
Now, what if we changed the ABI of delegates so that the context
pointer is passed after the explicit arguments? That is, `dg(1, 2)`
would pass (2, 1, 13). Then `f` would see 2 in b and 1 in a. It would
ignore 13. Seems everything would just work then.
You can't pass 3 arguments to a function that takes 2 arguments. It's a
violation of ABI and it won't work.
Can you give an example where it doesn't work? Are there requirements
for registers which have no corresponding argument?
Note that the additional argument is not supposed to be used by the
function. There's also no requirement that the argument survives the
call. That is, if the context pointer is passed in a register, the
called function may use that register for its own purposes, stomping
over the context pointer.