Local fixed sized arrays

Johan Engelen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 30 02:39:53 PDT 2016


On Monday, 27 June 2016 at 21:58:04 UTC, "Smoke" Adams wrote:
> I'm in need of a way to create a local array that isn't GC'ed. 
> It must be dynamic in the sense of setting the size at compile 
> time but it will be used only in scope and only on structs.

`alloca` is made for that purpose.
https://dlang.org/library/core/stdc/stdlib/alloca.html

Search for it online to read-up on proper usage so you can avoid 
the caveats.

cheers,
   Johan



More information about the Digitalmars-d-learn mailing list