4 ms·
Did Visual Studio finally make the jump?! (you could always just compile it as C++ code though)
by contrarian1234 3y ago
Did Visual Studio finally make the jump?! (you could always just compile it as C++ code though)
- bjourne 3y agoNope stdint.h has been in msvc for over 10 years. Other c99 features may be not supported though.
- jpfr 3y agoMSVC did a big rewrite of the C frontend around MSVC2013. I haven’t encountered C99 idioms that don’t work nowadays. Granted, I might not use every feature in my typical coding style…
- arp242 3y agoIt's been "fully" C99 (and C11, C17) compliant for about 2 or 3 years. The only missing C99 featured before that were relatively rarely used ones like _Pragma.
- flohofwoe 3y agoIt's not C99 compliant because that would require VLA support (which has been made optional in C11, which in turn enabled MSVC to be a C11 and C17 compiler, but not C99. Not that it matters much in practice though :)
- mort96 3y agoHasn't the main issue with MS been VLAs? I seem to recall that VLAs are the main reason MSVC won't ever support C99, and that MSVC is one of the main reasons why VLAs were made optional. It seems like MSVC supports C11 and C17 now, thanks to the removal of mandatory VLAs.
- zabzonk 3y agovehement 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...
- flohofwoe 3y agoExcept for VLAs (which are optional post-C99 anyway), MSVC actually has pretty good support for recent C versions, and since 2020 they're basically back on the "modern C" train: https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/ https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-...