Scope storage class

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Nov 26 13:45:07 PST 2008


On Wed, Nov 26, 2008 at 4:13 PM, Walter Bright
<newshound1 at digitalmars.com> wrote:
> Jarrett Billingsley wrote:
>>
>> 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.)
>
> There's no reason to suspect. Just obj2asm the output and see.

That'd be great if I had it.  I don't want to get into that, though.

> Furthermore,
> better results will come from:
>
>    int b() {
>        k -= 1;
>        return a(k, b(), x1, x2, x3, x4);
>    };
>
> instead of using the delegate.

So my suspicion is correct, then?  That is:

scope int delegate() b;
b = { ... };

Will allocate on the heap?


More information about the Digitalmars-d-announce mailing list