That might be the case if you plan to use the Microsoft C compiler as they have publicly said the don't have plans to update their C compiler.
However that is not your only option, since clang and several GCC ports will also work on Windows.
That might be the case if you plan to use the Microsoft C compiler as they have publicly said the don't have plans to update their C compiler.
However that is not your only option, since clang and several GCC ports will also work on Windows.
Still pretty incomplete last I checked but portability is better than it was.
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.
MSVC is probably pretty close to C99 these days. Designated initializers are C99, for example.
As far as I know, MSVC just implements the C subset of C++.
> enum Foo { A, B, C };
> Foo x = 1;
test.cc:2:9: error: invalid conversion from ‘int’ to ‘Foo’ [-fpermissive]
Foo x = 1;
I prefer not to use explicit casts because 1) using enum types is confusing to me 2) I frequently use values that are not in the enum - most often that's -1 as a way to indicate "missing". 3) I also like to iterate over all values from an enum using a plain for (int i = 0; i < NUM_FOOS; i++) without any fuss.> As far as I know, MSVC just implements the C subset of C++.
There are things that work in MSVC C mode that do not work in C++ mode.
int free;afaik,
int* arr = malloc(sizeof(int));
has never worked in c++.