This is precisely my understanding, and the reason I post the topic.<div>Tuples are not a reasonable solution.<br><br><div class="gmail_quote">On 4 January 2012 01:17, Timon Gehr <span dir="ltr"><<a href="mailto:timon.gehr@gmx.ch">timon.gehr@gmx.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 01/04/2012 12:09 AM, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Does returning a tuple give any ABI guarantees? How can I be sure multiple return values will return in consecutive <br>
</blockquote>
registers?<br>
<br></div>
* 1, 2 and 4 byte structs are returned in EAX.<br>
* 8 byte structs are returned in EDX,EAX, where EDX gets the most significant half.<br>
* For other struct sizes, the return value is stored through a hidden pointer passed as an argument to the function.<div class="im"><br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What if the return types are of different types, a float and an int...<br>
can I expect each to return in their own register types respectively?<br>
</blockquote>
<br></div>
No.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This needs to be defined and loosely guaranteed (within reason) so<br>
people can expect multiple return values to behave as expected on any<br>
architecture.<br>
</blockquote>
<br></div>
A possibility would be to allow TypeTuple return types.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
On 4 January 2012 01:02, Sean Kelly <<a href="mailto:sean@invisibleduck.org" target="_blank">sean@invisibleduck.org</a><br></div><div class="im">
<mailto:<a href="mailto:sean@invisibleduck.org" target="_blank">sean@invisibleduck.org</a><u></u>>> wrote:<br>
<br>
It's easy enough with Tuple, though better language support would be<br>
nice.<br>
<br>
Sent from my iPhone<br>
<br>
On Jan 3, 2012, at 2:40 PM, Manu <<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a><br></div><div class="im">
<mailto:<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>>> wrote:<br>
<br>
> Why doesn't D support multiple return values like many other<br>
modern languages?<br>
><br>
> Clearly the same syntax as Go wouldn't work, but I'm sure a neat<br>
and tidy syntax could be invented?<br>
> I constantly want to be able to return x,y from a function, or<br>
retVal,errorCode and I want the language to make some rough ABI<br>
guarantees, like multiple return values will be returned in<br>
consecutive registers, rather than a single return value register<br>
like C/C++, avoiding the need to pass output addresses through ref<br>
function parameters (slow!).<br>
<br>
<br>
</div></blockquote>
<br>
</blockquote></div><br></div>