[rust-dev] Newbie questions about memory management

Lucian Branescu lucian.branescu at gmail.com
Sun Dec 30 12:56:28 PST 2012


Would it be possible to have a more general mechanism for creating and
relinquishing objects? The rvalue trick seems obscure and only
situationally useful.
On 30 Dec 2012 20:52, "Patrick Walton" <pwalton at mozilla.com> wrote:

> On 12/30/12 12:50 PM, Colin Fleming wrote:
>
>> Great, thanks for the clarifications, Niko, that helps a lot. I think
>> I'll probably use the borrowed pointer notation.
>>
>> I'm assuming that the compiler optimisation you describe works for any
>> function returning an rvalue, not just for something that looks like a
>> constructor (i.e. functions called "new" are not special in any way)?
>>
>
> Yep. C++-style return value optimization is part of Rust's ABI and
> mandated by the language.
>
> Patrick
>
> ______________________________**_________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20121230/fe950aca/attachment.html>


More information about the Rust-dev mailing list