Hacker News new | ask | show | jobs
by ufo 2374 days ago
One of the interesting news is that they are now going to start requiring a C99 compiler, instead of only C90.

I've been considering to do the same on my own projects. What does HN have to say about this? Is anyone here still working in a context where C99 is not an option? Did anyone else also recently switch to C99? How did it go?

3 comments

It's now 2019, and as far as I know, MSVC still doesn't have full support for the 20-year-old C99 standard.

So either you restrict yourself to the subset of C99 which MSVC understands (AFAIK, newer MSVC releases understand more and more of the C99 standard), or just decide MSVC is no longer relevant (which is easier now that clang-cl exists; some big projects like Firefox and Chrome went this way, see for instance https://blog.mozilla.org/nfroyd/2019/04/25/an-unexpected-ben...).

I sometimes wonder if someday Microsoft would actively contribute to LLVM.
The only modern problem with switching to C99 is Visual Studio on Windows. You have 2 sensible choices:

1) Use clang to build on Windows.

2) Use the subset of C99 which is implemented in Visual Studio (which also requires compiling as C++, which isn't that difficult to handle).

3) Use C++17 with minimal features. This gives you a lot of needed libraries built-in and it is better supported than C99 (due to Windows).
> Use C++17 with minimal features

To paraphrase JWZ, "now you have N+M problems"

C++17 is a very close language to C18 if you avoid exceptions, classes and templates.
Why? Not being facetious. Wondering about the weights of benefits versus costs for users.
Mostly portable implementations of extensions for me; __thread, bool, inttypes.h, variadic macros, flexible array members etc. But declaring variables closer to the point of use is nice, as is struct initializers, compound literals and single line comments.

Compared to the rest, C99 contains a lot of useful improvements.

The only real cost is that Windows users will have a slightly less convenient time, which doesn't matter for most projects.