5 ms·
All very well, but I'd be really happy once (if) we ever get proper C99 support in MSVC. We basically need that at the neovim project if we want our code to com
by aktau 12y ago
All very well, but I'd be really happy once (if) we ever get proper C99 support in MSVC. We basically need that at the neovim project if we want our code to compile with MSVC. We don't want to compromise either, by for example compiling as C++ and not using some C99 features (we do use compound literals, we don't cast from void pointers, et cetera). The CRT improvements in MSVC 2013 and 2014 are a step, but only a small one. Sadly, compiling as C forces some kind of old mode where we can't even use declare-anywhere. For now, it seems like we'll need to let MingW and its offspring do it. Does anyone have a workaround?
- pjmlp 12y agoNever going to happen. For Microsoft C's time is passé. Herb Sutter already stated this multiple times. He was very clear that C99 support was only was is required by the C++ standard and to allow specific well known open source projects, which he referred to, to be ported to Windows.
- pavlov 12y agoSo it's "only" required by their primary language standard, as well as used in some very popular software... If that's barely enough to move Sutter into action, I wonder what would be an actually compelling case to him. The heavens open and a booming voice commands him to implement features X, Y and Z?
- taspeotis 12y ago> their primary language I read somewhere that Microsoft settled on C89 for the Windows kernel etc. so as far as their primary language goes their compiler implements it just fine.
- pjmlp 12y agoKernel code is being made C++ compliant according to a BUILD session when the going native wave started. As of Windows 8 is possible to use C++ for kernel code (vc++ got a new flag /kernel).
- pjmlp 12y agoVisual Studio 2013 launch http://events.visualstudio.com/eng/visual-studio-2013-launch/visual-studio-ide/iso-cplusplus-additions-in-visual-cplusplus/?SessionID=7508 http://events.visualstudio.com/eng/visual-studio-2013-launch... At minute 18:51. Focus is C++, there are no plans for C conformance.
- anon4 12y agoSounds like the next (2015) version should implement a lot more C99 compatibility, if I'm reading between the lines correctly.
- plorkyeran 12y agoYou don't have to read between the lines. The first CTP for the next version is out, and it does in fact implement a bit more C99 compatibility.
- spatulon 12y agoChromium uses an LLVM-based tool to automatically convert ffmpeg's C99 source code into MSVC-compatible C89: https://github.com/rbultje/c99-to-c89 https://github.com/rbultje/c99-to-c89 http://git.chromium.org/gitweb/?p=chromium/third_party/ffmpeg.git;a=commitdiff;h=cb6246cfdd1b984627a9b0cbe636ffd9024a7eaa http://git.chromium.org/gitweb/?p=chromium/third_party/ffmpe...
- eudox 12y agoThe fact that this exists alone is indicative is what a terrible platform Windows is. Entitled Windows users have absolutely no right to complain when programming language communities treat them as second class citizens.
- 0x09 12y agoThis tool has been unnecessary since VS2013. I posted some background info and links about it and MS' apparent attitude reversal back in Nov: https://news.ycombinator.com/item?id=6728226 https://news.ycombinator.com/item?id=6728226 The actual commit: http://git.libav.org/?p=libav.git;a=commit;h=16381923fb7b9087ce559fb1cd3594469ac6788b http://git.libav.org/?p=libav.git;a=commit;h=16381923fb7b908...
- plorkyeran 12y agoVS 2013+ does support compound literals and mixed declarations and usage. The latter is oddly buggy, but it's a rare area where they're fairly responsive to bug reports.
- slashdotaccount 12y agoIf GCC (MinGW) is working for you then why do you, a FLOSS developer, want your code to be compiled using the proprietary MS compiler? I'm genuinely interested.
- steveklabnik 12y agoIt's often better to integrate with the native tools of a given platform. For example, I wouldn't really ever contribute to a Mono project, even if it's on Linux, because .NET is weird Windows stuff. Same thing in reverse with MinGW and Windows. And if you want your project to truly treat Windows as first class, you have to recruit people who know, love, and use Windows.
- shadowfox 12y ago> if you want your project to truly treat Windows as first class, you have to recruit people who know, love, and use Windows. HN rumor has it that these creatures are mythical ;)
- steveklabnik 12y agoGiven the vast number of famous counterexamples, HN rumour (as usual) is pretty wrong.
- MichaelGG 12y agoWhy is .NET "weird Windows stuff"? Apart from obviously Windows-specific libraries like WMI, WinForms, etc. Even Microsoft released an example of the CLI that'd compile for FreeBSD among other OSes. So the cross-platform part of the runtime and much of the basic libraries is truly built-in. Or did I miss your point?
- steveklabnik 12y agoI was slightly exaggerating for effect.
- 12y ago
- jimrandomh 12y agoAccording to the article, C99 support was one of the motivations for doing this. "As part of this work, we've completely rewritten the core implementations of the printf and scanf functions (now with no #ifdefs!). This has enabled us to implement the remaining C99 features for the stdio library, to improve correctness checks in the library, and to fix many conformance bugs and quirks"
- maxlybbert 12y ago> Does anyone have a workaround? I've been using clang-cl ( http://llvm.org/builds/ http://llvm.org/builds/ ) for my personal stuff. Pros: * creates binaries that link to the platform CRT (no need for any redistributable) as long as you keep within C99 or C11 Cons: * not officially supported yet * doesn't yet support enough C++ to be useful for anybody wanting that * while the C99/C11 language is available, you still need to rely on the Windows header files and libraries, so you have variable length arrays, declare anywhere, compound initializers, _Generic, but not snprintf, fenv.h, etc.
- jevinskie 12y agoclang-cl and MS C++ ABI compatibility for Clang/LLVM is going to be very exciting. Some said it was an impossible project but it is quickly progressing. The start of SEH is already committed. I believe the mangling is complete. Linkage types are still being tweaked. Windows Phone is already partially supported. The inalloca attribute has been in ToT for a long time. I think it will be in a usable state within a year. Sometimes you just have to use a binary library that you cannot recompile. If it is C++, you are limited with your compiler choices due to ABIs. I hope the various sanitizers are ported as well!
- bluecalm 12y agoIs there any problem with MinGW ? From my very limited experience gcc is just a better compiler than MSVC: it generates faster code, has more options to configure it (more optimization options, more options for displaying warnings, all the new floating point stuff available, actually supports new standards and let you choose which language version you want etc.).
- aktau 12y agoNo, I like both gcc and clang, and thus mingw. Still, we would like to be portable to as many modern, often-used compilers as we can. Also anecdotally, I wrote a software renderer a few months ago that ran almost 50% faster when compiled with MSVC 2013 than with MingW 64 (gcc 4.8), all optimizations enabled. This might not be true for other types of programs though.
- stinos 12y agoit generates faster code Not sure if that is true in general - the few proper benchmarks I found indicate that there is no clear winner. (Except for the Intel compiler, which beats both)
- bluecalm 12y agoRight. I am speaking from experience with relatively simple number crunching code. It became faster once I upgraded to newer version of gcc. Now even very simple things (like say 8 queens) are just 5-10% faster when compiling with GCC 4.8 comparing to MSVC.
- maxlybbert 12y agoGCC certainly releases more often than Visual Studio, with the end result being that GCC has support for newer standards much sooner than Visual Studio. But if you intend to run your programs on Windows systems without GCC installed, you have to find the support DLL, and it's not always easy to find.