3 ms·
VLAs are unsafe in the worst kind of way as it is not possible to query when it is safe to use them. alloca() at least in theory can return null stack overflow,
by _0w8t 4y ago
VLAs are unsafe in the worst kind of way as it is not possible to query when it is safe to use them. alloca() at least in theory can return null stack overflow, but there is no such provision with VLA.
- astrange 4y agoThey're not unsafe (in the memory sense) as long as they check for overflow and reliably crash if there is one.
- naasking 4y agoIf a lot of platforms don't implement this check reliably, then it's unsafe in practice at this time, even if not in theory.
- astrange 4y agoWho out there has a version of stack checking that doesn't actually check the stack…? If it doesn't check by default, as C doesn't, then it's not "as long as".