4 ms·
From my point of view VLA belongs to a class of features (along with, for example, setjump/longjump) that are best not mentioned to novice developers. Standard
by lmilcin 5y ago
From my point of view VLA belongs to a class of features (along with, for example, setjump/longjump) that are best not mentioned to novice developers.
Standards aimed at security/reliability (for example MISRA) outright ban using these as they are just not worth the risk.
I have never actually needed VLAs in all the projects I did in ANSI C and I only once used alloca to provide a buffer on a stack for a serializer, but in that case the buffer size was configured at the start of the application and I could most likely just used a buffer provided by the application.
- asteroidbelt 5y ago> best not mentioned to novice developers I see elitarism here. Novice developers are perfectly capable to understand anything. Many of them better than many older developers who (let's admit it) are often not able to comprehend the reasons for modern features and idioms. Many of old developers still think in 30 years old stereotypes like "malloc is expensive" or "safe languages are needed only to bad programmers". There were reasons why features were developed. One may ban certain features in their project, that's fine. But both VLA and setjump/longjump have their applications.
- deleted 5y ago[deleted]