3 ms·
vehement oppostion from ms my be one of the reasons for them being optional (and thus worthless) but the main one is that that they are impossible to use correc
by zabzonk 3y ago
vehement oppostion from ms my be one of the reasons for them being optional (and thus worthless) but the main one is that that they are impossible to use correctly. what happens if you make one too big?
- mort96 3y agoI think they could potentially have some very limited valid use cases, but I agree that a fixed length array and/or heap allocation is usually much better than VLAs. I was mainly just pointing out that MS's lack of C99 support isn't really a part of keeping C89 alive, especially now that they officially support C11.
- aragilar 3y agoI'm not sure how robust that support is though: https://discuss.python.org/t/requiring-compilers-c11-standard-mode-to-build-cpython/26481/23 https://discuss.python.org/t/requiring-compilers-c11-standar...
- mort96 3y agoIf the reply is correct, the only issue there is that they're compiling in C89 mode. If you pass `-pedantic -std=c89` to GCC, it too will warn on C99+ features. If you pass `/std:c11` or `/std:c17` to MSVC, C99+ features should work.
- Dylan16807 3y ago> what happens if you make one too big? Doesn't that apply to fixed length arrays too?
- mort96 3y agoIt does, but if you create a fixed length array that's too big, you'll just deterministically blow the stack regardless of user input. With VLAs (or alloca), your array length is determined by some runtime property. Whether you blow the stack doesn't just depend on the code path any more, but on the data you're operating on too. As a bonus, that data is often user input...