3 ms·
The other method is to change the calling convention and use a different ABI. NetBSD syscalls have multiple return values in registers, although it is little us
by justincormack 13y ago
The other method is to change the calling convention and use a different ABI. NetBSD syscalls have multiple return values in registers, although it is little used (pipe returns two args, plus functions that return 64 bits on 32 bit platforms. If you were inventing a new ABI this could be nice. Multiple return values are very idiomatic...
- mikeash 13y agoFrom the ABI perspective, struct returns are multiple return values. ARM64 allows structs to be returned in registers if the struct members are suitable for it.
- justincormack 13y agoI didnt know that. Apparently amd64 lets you return two 64 bit values in registers too, but no more.
- mprovost 13y agoTwo is still an incredibly handy feature. I would guess that the most common case for returning multiple values is data and size, like all the functions that return a string and the length of the string.
- justincormack 13y agoYes. Or the value. error style as used by node.js. forcing errors unto the domain gets messy.