2 ms·
key being "safely placed". VLAs and allocas keep being deprecated everywhere as they are a time bomb. In practice you need safe upperbound for VLAs and alloca,
by gpderetta 3y ago
key being "safely placed". VLAs and allocas keep being deprecated everywhere as they are a time bomb.
In practice you need safe upperbound for VLAs and alloca, so you might as well just allocate the upper bound as a fix size array outright. If you do not initialize the array, there is no real additional cost other than the additional stack probes. On GCC at least, alloca and VLAs disable some optimizations (like inlining) so it is really a wash.
If you need truly unbounded size allocations, you need an heap fallback anyway.