[ prog / sol / mona ]

prog


Inalienable Core of "Practical" Programming Languages

12 2021-11-03 23:52

>>11

In regards to undefined behavior: That's entirely possible too. I've never really looked into the "real world" implications of using them as in about 20 years of writing C i've never felt the need for a variable sized array. There obviously might be cases i didn't run into but those are possibly quite niche.

In general there is a ton of ways to deal with situations where you might use a VLA. Mostly it's the use a reasonable fixed size array and forget about it (after including appropriate checks of course - those should have been there already anyways to avoid insane VLA sizes) but maybe your data is better organized in a linked list and your list allocator is tuned for your use case? You use your own "smart array" again tuned for your use case, your data will be reused so malloc is worth it and so on, and so on...

23


VIP:

do not edit these