5 ms·
> IIRC, MSVC stubbornly refuses to add support for variable-length arrays (which AFAIK are required for full C99 support). You are correct that VLAs are mandat
by lelanthran 4y ago
> IIRC, MSVC stubbornly refuses to add support for variable-length arrays (which AFAIK are required for full C99 support).
You are correct that VLAs are mandatory for C99, but they turned out to be such a
bad idea that they are optional in C11 onwards.
> I don't know if there's anything else on that list of C99 features that MSVC doesn't support yet.
IIRC, MSVC's `snprintf` and friends are broken (returns incorrect values and/or interprets the size parameter incorrectly). I think all of the annexure K stuff is broken in MSVC.
- uecker 4y agoI think VLAs were a very good idea and they were not made optional because somebody thought they were a bad idea, but simply to make C11 easier to implement. VLA can be dangerous when the size depends on external input an when implemented without stack probing.
- pjmlp 4y agoNo they are not. Google has paid the development effort for the Linux kernel to get rid of all VLA occurrences.
- cesarb 4y agoThe Linux kernel is a very different environment than user space; it has a very limited stack space (16 KiB IIRC), and the consequences of exceeding that are worse than in user space. > Google has paid the development effort for the Linux kernel to get rid of all VLA occurrences. IIRC, what they were really interested in getting rid of was not the normal VLA we're talking about, but something even more esoteric called VLAIS (variable length arrays in structures), which clang didn't support. See https://lwn.net/Articles/441018/ https://lwn.net/Articles/441018/ for a discussion about that.
- pjmlp 4y agoI have seen all Linux Plumber talks on the subject.
- uecker 4y agoI was tangentially involved in this and I think this was misguided.
- lelanthran 4y ago> when implemented without stack probing. I dunno how to probe the stack in standard C, and so I never used VLAs, nor allowed them because (I thought that) there was no way to determine if a VLA declaration would cause a stack overflow.
- masklinn 4y ago> I think all of the annexure K stuff is broken in MSVC. Doesn’t annex k only exist in MSVC because it’s a bunch of crap MS got the committee to add and no one else wanted to implement? And isn’t it a C11 thing?
- lelanthran 4y ago> Doesn’t annex k only exist in MSVC because it’s a bunch of crap MS got the committee to add and no one else wanted to implement? Yes, but in a perverse twist of fate, Microsoft's implementation does not conform. > And isn’t it a C11 thing? I stand corrected, it is a C11 thing.
- kevin_thibedeau 4y agoThe MS implementations were given different semantics in annex K. They aren't standard compliant.