Re:The Linux Kernel Is Now VLA (Variable-Length Array) Free
by int_19h on Monday October 29, 2018 @03:23PM
(#18330440)
That's orthogonal to arrays being variable-length or not, though...
[ Parent
| on HN ]
Re:The Linux Kernel Is Now VLA (Variable-Length Array) Free
by pjmlp on Monday October 29, 2018 @04:39PM
(#18331170)
The point was that the way VLAs were designed in C99, it was a motorway to stack corruption, leading to dropping it out as optional feature in C11 and C++ not even considering them.
Re:The Linux Kernel Is Now VLA (Variable-Length Array) Free
by int_19h on Tuesday October 30, 2018 @12:19AM
(#18333990)
I don't see anything in the wording of C99 around VLAs that requires them to always be allocated on the stack. That implementations did so regardless is, arguably, a defect on their part, and a quality-of-implementation issue.
Re:The Linux Kernel Is Now VLA (Variable-Length Array) Free
by pjmlp on Tuesday October 30, 2018 @03:59AM
(#18334619)
Given C design culture how could you expect any other kind of approach to their implementation?
Re:The Linux Kernel Is Now VLA (Variable-Length Array) Free
by int_19h on Tuesday October 30, 2018 @04:46AM
(#18334823)
Well, the whole point of VLAs was supposed to placate the math/numeric crowd somewhat, and they generally expect things to be a little bit higher-level than what's otherwise mandated by the C "zero overhead" philosophy. Since VLAs are opt-in, code that cares more about perf could always skip them and not pay the tax.
But yes, it was probably too naive to expect that to work out.