3 ms·
> Rust also has multiple return (because Rust returns via > hidden out-param) Not quite. Rust does have multiple returns, but that's just the obvious result
by kibwen 13y ago
> Rust also has multiple return (because Rust returns via
> hidden out-param)
Not quite. Rust does have multiple returns, but that's just the obvious result of supporting tuples in the language (to say nothing of tagged unions). The hidden out-param you speak of is just there to guarantee return-value optimization, allowing the compiler to construct return values in higher stack frames to avoid the overhead of copying.
- wyager 13y ago>Rust does have multiple returns, but that's just the obvious result of supporting tuples in the language (to say nothing of tagged unions). Yes, but it's (from a user standpoint) practically the same thing! >The hidden out-param you speak of is just there to guarantee return-value optimization Yes, which allows for the efficient return of arbitrary-sized structs, i.e. multiple return.