3 ms·
Alright, but that doesn't really solve anything, does it? It just makes the problem easier to debug.
by enriquto 7y ago
Alright, but that doesn't really solve anything, does it? It just makes the problem easier to debug.
- thenewnewguy 7y agoWhat's the problem, that the stack is capable of being overflowed? How do you expect the C compiler to fix that?
- enriquto 7y agoThe stack is not a concept belonging to the C language definition, it is just an implementation choice made by some compiler vendors (all that I know of). The semantics for VLA are clear and very useful. I would certainly not expect that the memory for VLA is implemented on the same stack as the function call stack. My complain for C programming (what I called its "tragedy") is that no compiler provides a mechanism for safely using all available memory via VLA. Edit: you may answer: "use alloca then". But the syntax for alloca is not that convenient, and the semantics are very different. A common use for VLA is to declare a temporary array inside the body of a loop, this is not possible with alloca.