Hacker News new | ask | show | jobs
by asveikau 2297 days ago
Microsoft has started to implement more of C99 over the years. I think it was 2015 where they implemented mixed declaration and code. I noticed they put stdint and stdbool finally in 2010 or so.

Still pretty incomplete last I checked but portability is better than it was.

1 comments

Those features are based on ISO C++ requirements, regarding the adoption of underlying C features and respective standard library.
Mixed declaration and code is very old in C++, and Microsoft has always supported it there. It wasn't until vs2015 that they let you do it in a .c file.
Sure they did let do it, as long as that C file as compiled as C++.
There is a "C language mode" inside cl.exe (by file extension or by /TC flag) and there's plenty of C that doesn't compile as C++.

eg.:

   char *p = malloc(n);
No explicit casts from void*!

Anyway, around the time they started allowing mixed declarations and code in a .c file, I was noticing on-the-job that this was becoming a disproportionate source of build failures in intended-to-be-portable .c files my colleagues were writing on Unix. It was as if cultural memory of pre-C99 declaration requirements was disappearing specifically around that time. So it makes sense to me that they went ahead and added it. They probably got a lot of complaints.