3 ms·
I'm not sure what your point is. You could replace the VLA with malloc in that example and exhaust your entire VM space. In the rare cases where VLAs might pro
by wahern 5y ago
I'm not sure what your point is. You could replace the VLA with malloc in that example and exhaust your entire VM space.
In the rare cases where VLAs might prove useful, e.g. a vector math library (IIRC, a major reason for VLAs was to help FORTRAN programmers transition to C), this difference absolutely does matter in reality.
- cryptonector 5y agoMaybe I missed the point of your comment. Mine is that the scoping difference between VLAs and alloca() isn't relevant to the question at hand of how to protect against memory corruption due to large stack allocations.