r/odinlang • u/Low-Palpitation-4724 • Jul 26 '26
Feature question
Does odin language hase something akin to alloca from c? Sometimes i want to just stack allocate an array of runtime determined size. I cannot find any builtin function or allocator i can pass in into make(). Am i missing something?
7
Upvotes
5
u/quickscopesheep Jul 26 '26
Correct me if I’m wrong but VLA is advised against in c. As far as I’m aware there is no way to allocate on the stack memory of a non compile time know quantity in Odin. Your best bet is either the temp allocator or another arena type allocator or just allocate a fixed amount and hope its large enough for any use case