scope escaping
Adam D. Ruppe
destructionator at gmail.com
Thu Feb 6 12:26:29 PST 2014
On Thursday, 6 February 2014 at 20:17:25 UTC, Benjamin Thaut
wrote:
> foo([1 2 3 4]); // allocates the array literal on the stack,
> because it is scoped.
Absolutely. In fact, generically, any scope item could be moved
to the stack. We were just discussing in the chat room how scope
= stack allocation and scope = don't escape the reference
actually go hand in hand; they are not two separate features,
stack allocation is an optimization enabled by the restriction...
and the restriction is required by the optimization to maintain
memory safety.
More information about the Digitalmars-d
mailing list