Comment by lelanthran
7 hours ago
> You can allocate dynamically on the stack in C as well. Every compiler will give you some form of alloca().
And if it doesn't, VLAs are still in there until C23, IIRC.
7 hours ago
> You can allocate dynamically on the stack in C as well. Every compiler will give you some form of alloca().
And if it doesn't, VLAs are still in there until C23, IIRC.
`-Wvla` Friends don’t let friends VLA :)
alloca is certainly worse. Worst-case fixed size array on the stack are also worse. If you need variable-sized array on the stack, VLAs are the best alternative. Also many other languages such as Ada have them.