8 ms·
VC++ has historically been the odd man out, but it's improved greatly in the last couple of versions. Certainly, VS2013 has reasonable support for a lot of C99
by to3m 11y ago
VC++ has historically been the odd man out, but it's improved greatly in the last couple of versions. Certainly, VS2013 has reasonable support for a lot of C99 code. My C99 code builds on clang (OS X), gcc (Linux), and VC++ (Windows). Maybe I need to get more adventurous, but what I see as the key improvements (designated initializers, compound literals, declarations (nearly) anywhere) are now in place.
Main omissions I've noticed: printf isn't quite the same (no 'z' modifier, the 'n' forms are noticeably inferior), no VLAs.Also, standard library isn't POSIX (which is not an omission but a lot of C code assumes POSIX so you'll probably end up having to deal with this).
I'm surprised you mention intrinsics, since VC++ has a wide selection - https://msdn.microsoft.com/en-us/library/hh977022.aspx https://msdn.microsoft.com/en-us/library/hh977022.aspx - and I'd expect, though without proof, the differences between many of those available on both VC++ and gcc/clang to be something you could work around with #define or, failing that, a small inline function (and cross your fingers).
Aside from VLAs, which is annoying, you can work around most of these with wrapper functions and #defines. So I've been pleased enough with the latest VC++. As a long time programmer for multiple platforms, I can put up with a certain amount of deprivation, and having to put in a bit of effort doesn't bother me (all that much). But I've noticed a tendency for people to sometimes assume that "multiple platforms" means "ten different types of gcc+POSIX+fork+pthreads". I'm sure that even shiny new C99-friendly VC++ won't make them happy.
- pjmlp 11y ago> But I've noticed a tendency for people to sometimes assume that "multiple platforms" means "ten different types of gcc+POSIX+fork+pthreads". Having done multiple platform C development across Aix, HP-UX, Solaris, GNU/Linux and Windows in the first .com wave, as well as, having some embedded knowledge, it is always interesting that for some people only gcc and now clang exist. As for C99, Microsoft is pretty clear that are only supporting what is required by the C++ standard.
- ch_123 11y agoI believe they have started explicitly targeting C99 support in more recent versions in order to make it easier to port C code developed against gcc or clang. Here's an older article - 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... (I've seen more recent ones, but I can't find an example to hand)
- pjmlp 11y agoNo they were pretty clear that it is only what is required by C++ standard, and some high profile customers. There was a C9 interview about it, need to search for it.
- eatonphil 11y agoOut of curiosity, who are MSVCs high profile customers?
- pjmlp 11y agoThey didn't mentioned on the interview. If I recall correctly it was at a Visual Studio event last year, on those floor interviews they publish with the teams on C9.
- cwyers 11y agoAdobe is almost certainly one: https://helpx.adobe.com/creative-suite/kb/microsoft-visual-c-runtime-error.html https://helpx.adobe.com/creative-suite/kb/microsoft-visual-c... There's probably quite a few internal-only users of Visual C++ too. EDIT: Well, they're a high-profile user of Visual C++, I have no idea if they require C99 support but they ship a Mac version so it's possible.
- pjmlp 11y agoOne of them was FFMpeg, from the video I digged out.
- pjmlp 11y agoCould not find the interview video, but this was another one I remembered have watched: https://channel9.msdn.com/Events/Visual-Studio/Launch-2013/VS112 https://channel9.msdn.com/Events/Visual-Studio/Launch-2013/V... Starting at 00:18:40, note the "not an intent to conform to C99/C11". FFMpeg was one of the customers
- pjmlp 11y ago
- AnimalMuppet 11y agoWhen I was in that situation (maybe ten years ago), we ran gcc on Aix, HP-UX, Solaris, Linux, Tru64, SGI, and maybe a couple of others. Then of course there was Windows, which used the Microsoft compiler. But using only two compilers made the ten or so platforms easier to deal with. (There still was a bunch of code that was "#ifdef SGI/#else/#endif", and similarly for other platforms, but at least the compilers behaved the same.)
- pjmlp 11y agoWe had to use the vendor compilers, so no fun. This was the only time period I used C instead of C++ at work. However I do confess, the situation for C++ support was even worse, so although I am not fan of C, the decision made sense from business point of view.
- AnimalMuppet 11y agoHow long ago was your experience? Was gcc an option at that time? Or did management require you to use the vendor compiler? What we did was, we used the vendor compilers to compile gcc for a platform (or maybe used gcc to cross-compile itself, I forget). Then we used that gcc to compile gcc for that platform. Then we used the new gcc to compile gcc for that platform, and made sure that it was the same as the previous gcc. This wasn't easy - we had one guy that this is pretty much all he did for months. But it got us to a place where we were free from the vendor compilers.
- pjmlp 11y ago> How long ago was your experience? It was back in the first .com wave, so 1999 - 2002. > Was gcc an option at that time? Or did management require you to use the vendor compiler? Customers did. Our software needed to integrate with their existing toolchains. At least for our customers gcc was not a serious compiler, given the license and being that funny open source thingy.
- stinos 11y ago"multiple platforms" means "ten different types of gcc+POSIX+fork+pthreads" This. Unfortunate, but some even seem to think C99 support automatically means POSIX and then start complaining a platform isn't compatible if it doesn't handle what they thought was portable code..
- uxcn 11y agoWhy is it bad to expect a portable operating system interface? Almost all languages have been doing this over the last decade (C, C++, Java, Go, Python, Ruby, PHP, etc...).
- stinos 11y agoExpecting it isn't bad, blindly assuming POSIX is available everywhere is bad, as in calling your code cross-platform because it uses just C99 and POSIX for instance
- uxcn 11y agoThe majority of the time it's a safe assumption though, so I'm not sure developers can really be considered to blame. The reality is, without it, developing software for a platform takes more effort which I think is one of the reasons languages have taken on the initiative of building portable interfaces. Even C11 has added threads.h.
- corysama 11y agoI once had the pleasure of writing a game engine that ran on Windows, Xbox, Xbox360, PS2, PS3, GameCube and the Wii. The 3 Microsoft systems shared some very basic Win32-style system API, but the other 4 were completely unique. When I see people talk about "cross platform" code only to find they mean "Linux and OSX!" I chuckle a little.
- uxcn 11y agoI can only guess what the portable code for PS3 looked like :).
- StephanTLavavej 11y agoFYI, C99 printf including 'z' for size_t was fully implemented in VS 2015.
- pjmlp 11y agoMost likely you are not allowed to comment on it, but has the official position from the last C9 VS team interviews changed?
- StephanTLavavej 11y agoI believe we're hoping that Clang/C2 will satisfy those who want to build C99 TUs on Windows. Personally, I have absolutely no interest in C99 (I wasted a year and a half of my life learning C before C++).
- spongo2 11y agocorrect.
- pjmlp 11y agoThanks for replying. I had a similar experience back in the MS-DOS days still, and share the same opinion. Turbo Pascal -> C (meh) -> C++ (great back in business!) Even though I mostly do JVM and .NET nowadays, still enjoy playing with C++ on the side, specially for mobile OS coding. I see dropping C support on Windows as a means to force developers to migrate to more secure languages, but of course Microsoft should do what makes business sense.
- to3m 11y agoThanks for the note. Switching to VS2015 just worked its way up my to do list.
- StephanTLavavej 11y agoYou'll want to read these changelogs for the CRT and the STL: http://blogs.msdn.com/b/vcblog/archive/2014/06/18/crt-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1.aspx http://blogs.msdn.com/b/vcblog/archive/2014/06/18/crt-featur... , http://blogs.msdn.com/b/vcblog/archive/2014/06/06/c-14-stl-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1.aspx http://blogs.msdn.com/b/vcblog/archive/2014/06/06/c-14-stl-f... , and http://blogs.msdn.com/b/vcblog/archive/2015/07/14/stl-fixes-in-vs-2015-part-2.aspx http://blogs.msdn.com/b/vcblog/archive/2015/07/14/stl-fixes-... .