3 ms·
Actually, about 6 months ago Microsoft did an about face. They're now approaching near complete C99 support, adding features deliberately rejected by C++, such
by wahern 12y ago
Actually, about 6 months ago Microsoft did an about face. They're now approaching near complete C99 support, adding features deliberately rejected by C++, such as designated initializers and compound literals.
In fact, compound literal syntax is probably incompatible with C++, because similar syntax in C++ requires entirely different object lifetimes--expression scope in C++, block scope in C99.
Actually, I think the target may be C11, as I doubt they'll add VLAs.
- dottrap 12y agoIs this really true? Last I saw, they were adding some the of C99 features (because the C++11/14 spec actually required some of it), but not going all the way. And it was unclear if they were only focusing on the language or the standard library or both. (I'm willing to skip C99 for C11 because am sick of dancing around Visual Studio for compatibility. Clang for Visual Studio is looking really appealing to me.) Why they have the only world's C++ compiler that can't handle C baffles me. What did they screw up so badly in their implementation that every other C/C++ compiler got right?
- pjmlp 12y ago> Why they have the only world's C++ compiler that can't handle C baffles me. Why? C++ was born at AT&T, the same place C was born. Given its design to be as compatible with C as possible, it was quite natural for C compiler vendors to bundle a C++ compiler with their C compiler. There isn't any requirement in ANSI/ISO C++ that a C++ compiler vendor is obliged to support C. Microsoft's decision is not technical, but political. From their point of view, if you want to write C style code, there isn't nothing in C++ that prevents it. On the other hand, C cannot provide at the language level the mechanisms available in C++ to write safe code. Not to mention that Windows APIs are mostly COM based since the Windows XP, anyway. If you want C on Windows, or to have fun using COM or WinRT from C, there are plenty of other compilers available. Both Symbian and BeOS were C++ based OS. I for one, enjoy seeing Windows going into the same direction.
- wahern 12y agoSee my post down thread. Or just read these pages http://msdn.microsoft.com/en-us/library/hh409293.aspx http://msdn.microsoft.com/en-us/library/hh409293.aspx http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-librar... http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-stu...
- pjmlp 12y ago> They're now approaching near complete C99 support, adding features deliberately rejected by C++, such as designated initializers and compound literals. No they did not. Herb Sutter was very explicit about this. - C99 language features as required by the C++11/14 standards - compound literal syntax just to allow certain well known open source project to be ported to Windows, mainly game related projects Nothing else is planned as shown on his slides. http://channel9.msdn.com/Events/Visual-Studio/Launch-2013/VS112 http://channel9.msdn.com/Events/Visual-Studio/Launch-2013/VS... Edit: Added link to Visual Studio 2013 launch presentation from Herb Sutter.
- wahern 12y agoI know what he said. But I think he's understating the changes. Visual Studio 2013 supports both compound literals and designated initializers. That required core language changes, and are arguably the two biggest language changes in C99 from a syntax standpoint. Both were rejected by C++ and will never appear in C++, so they're entirely unnecessary. See http://msdn.microsoft.com/en-us/library/hh409293.aspx http://msdn.microsoft.com/en-us/library/hh409293.aspx See also http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-librar... And Visual Studio 2014 added most of the missing pieces, including a standards compliant snprintf. See http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-stu... Heck, they even met C99 half-way on the restrict qualifier by adding a __restrict keyword. C++ also rejected restrict, FWIW. Those are all comprehensive, non-trivial changes, and most are irrelevant to C++. Microsoft can talk it down however they want, but the new features speak for themselves. I don't even use Visual Studio. Or Windows for that matter. But I value standards compliance and portability, and I was happy to see Microsoft change their mind on this. They did it rather quietly ("No, we aren't targeting C anymore, but here are almost all the new C features which we said we'd never support in a million years."), perhaps because they so adamantly refused to support it before. Yes, the reason they finally capitulated is because there was simply too much open source C99 software in the wild, and it was becoming a pain point for Windows developers not being able to use that software with their preferred development environment--Visual Studio. But at this point they've implemented almost all the features that actually matter. Features like VLAs and _Complex are rarely used, so I doubt Visual Studio will get that. But both are optional in C11 anyhow. With little effort--one of the biggest changes being _Generic--Visual Studio could become C11 compliant, at least in practice.