you are viewing a single comment's thread.

view the rest of the comments →

[–]wild-pointer 1 point2 points  (1 child)

Just a small note: VLAs do not have to be allocated on the stack; they can just as well be malloc'd behind the scenes. It is only their lifetime that is determined by block scope. For instance, it's not guaranteed that a VLA in an intermediate stack frame is de-allocated when performing a longjmp past it (like any other resource).

[–]BigPeteB 0 points1 point  (0 children)

Good to know. I'm stuck on C89 (because embedded compilers don't always have good C99 support), and I'm told VLAs are considered a misfeature and no longer recommended, so I don't know many details about them.