Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by chjj on Thursday August 04, 2022 @02:29PM
(#32346554)
You shouldn't be writing C if you're not a careful coder.
[ Parent
| on HN ]
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by pjmlp on Thursday August 04, 2022 @02:42PM
(#32346713)
Yeah, right.
https://msrc-blog.microsoft.com/2019/07/16/a-proactive-appro...
https://research.google/pubs/pub46800/
https://support.apple.com/guide/security/memory-safe-iboot-i...
Maybe you could give an helping hand to Microsoft, Apple and Google, they are in need of carefull C coders.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by chjj on Thursday August 04, 2022 @03:16PM
(#32347098)
I'm not sure if you intentionally missed my point. Everything in C requires careful usage. VLAs aren't special: they're just yet another feature which must be used carefully, if used at all.
Personally, I don't use them, but I don't find "they're unsafe" to be a convincing reason for why they shouldn't be included in the already-unsafe language. Saying they're unnecessary might be a better reason.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by pjmlp on Thursday August 04, 2022 @04:00PM
(#32347571)
The goal should be to reduce the amount of sharp edges, not increase them even further.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by fpoling on Thursday August 04, 2022 @04:11PM
(#32347697)
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.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by astrange on Friday August 05, 2022 @01:12AM
(#32351997)
They're not unsafe (in the memory sense) as long as they check for overflow and reliably crash if there is one.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by naasking on Friday August 05, 2022 @03:33AM
(#32352886)
If a lot of platforms don't implement this check reliably, then it's unsafe in practice at this time, even if not in theory.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by astrange on Friday August 05, 2022 @07:40AM
(#32354700)
Who 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".
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by samatman on Thursday August 04, 2022 @02:40PM
(#32346691)
And if you're a careful coder writing C, you should give the VLA the stink eye unless it's proving its worth.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by kllrnohj on Thursday August 04, 2022 @03:29PM
(#32347236)
Hint, that means nobody should be writing C.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by krallja on Thursday August 04, 2022 @03:33PM
(#32347270)
Where is the lie?
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by marcosdumay on Thursday August 04, 2022 @04:25PM
(#32347861)
Too bad we have all that legacy C code that won't just reappear by itself on a safer language.
That means there are a lot of not careful enough developers (AKA, human ones) that will write a lot of C just because they need some change here or there.