On 1/13/2015 11:42 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schue...@gmx.net>" wrote:
On Tuesday, 13 January 2015 at 00:05:31 UTC, Walter Bright wrote:
On 1/12/2015 3:17 PM, deadalnix wrote:
On Monday, 12 January 2015 at 22:17:57 UTC, Walter Bright wrote:
Yes, it does. Returning an int in EAX now becomes returning a pair [EAX,EDX].
It is not that big of a deal, EDX is a trash register anyway if memory serve,
but then, it become very bad when it do not fit in register anymore.
Returning a slice, for example, already consumes EAX and EDX. Adding an error
code pushes that into returning via a pointer to a stack temporary.
There are techniques to mitigate that. For example, Rust is smart enough to
encode the "not-present" state for pointers as a NULL pointer (Rust pointers are
non-null).
Such mitigation techniques pretty much confirms there's an efficiency cost to
having the error code.
If an error code needs to be returned, it can be encoded as a misaligned pointer
(if you're feeling adventurous). Don't know whether Rust does the latter,
though.
Of course, these things have costs of their own.