Automatically using stack allocations instead of GC
Johan Engelen
j at j.nl
Mon Oct 23 16:46:05 UTC 2017
On Monday, 23 October 2017 at 12:49:18 UTC, Nicholas Wilson wrote:
> On Monday, 23 October 2017 at 10:42:44 UTC, Dmitry Olshansky
> wrote:
>> On Monday, 23 October 2017 at 09:06:21 UTC, Per Nordlöw wrote:
>>>
>>> int foo()
>>> {
>>> auto x = [1, 2]; // should be allocated on the stack
>>> return y = x[0] + x[1];
>>> }
>>
>> LDC does something like that IIRC.
>
> It does.
It does not.
https://godbolt.org/g/i21t8G
> https://github.com/ldc-developers/ldc/blob/master/gen/passes/GarbageCollect2Stack.cpp
This broke somehow quite a while ago :(
I haven't found time to look at it. Would be great if someone did
(most important: add tests for it!!!!!).
-Johan
More information about the Digitalmars-d
mailing list