3 ms·
In low level languages such as C, I imagine it was an attempt to map to the machines of the day. It isn't hard to come up with an ABI that allows for returning
by com2kid 13y ago
In low level languages such as C, I imagine it was an attempt to map to the machines of the day. It isn't hard to come up with an ABI that allows for returning multiple values, and with registers being thrown into CPUs left and right now days, using 1 more register to allow two return parameters would actually be really nice.
(Of course you'd have to dump anything beyond that onto the stack!)
I imagine the world would be a lot different (or at least a bit less buggy!) if C had allowed for returning an error code in addition to a return value.
Once you get to higher level languages though, the need sort of falls away. Put data into a container of some type, call it a day.