On Fri, Mar 26, 2021 at 7:36 AM Daniel Kozak <kozz...@gmail.com> wrote:

> On Fri, Mar 26, 2021 at 7:31 AM Daniel Kozak <kozz...@gmail.com> wrote:
>
>> On Fri, Mar 26, 2021 at 6:50 AM Jack via Digitalmars-d-learn <
>> digitalmars-d-learn@puremagic.com> wrote:
>>
>>> What's the equivalent of C's VLA in D? scoped from std.typecons
>>> doesn't seem to work with arrays. Should I use alloca() for my
>>> array or is there something else?
>>>
>>
>> https://dlang.org/library/std/array/static_array.html
>>
> Sorry I was misread this
>

You can use allocator:

import std.experimental.allocator.showcase;
import std.experimental.allocator;
import std.stdio;

StackFront!4096 stackAlloc;

void main() {
    int[] a = stackAlloc.makeArray!int(2);
    writeln(a);
}

Reply via email to