Scope storage class

Robert Jacques sandford at jhu.edu
Wed Nov 26 14:12:15 PST 2008


On Wed, 26 Nov 2008 13:24:57 -0500, Jarrett Billingsley  
<jarrett.billingsley at gmail.com> wrote:
> scope int b() { .. }
>
> The reason I wonder is because I would expect that the compiler is
> still allocating the delegate on the heap if you use the first syntax.
>  (the second is also shorter and clearer.)

Just as a point of reference (in D1)
scope Object a = new Object(); // Stack Allocated
scope Object b;
b = new Object(); // Heap Allocated

So there may be some merit to scope int b() { .. } vs scope int b(); b =  
{...}


More information about the Digitalmars-d-announce mailing list