Navaneeth K N
Navaneeth K N

Reputation: 15501

Using C99 features for a cross platform application

I am writing a new project in C and I am wondering is it a good practice to use C99 features? I know it will work with GCC and not with MSVC. So I have to use something like MinGW in Windows to get the compile. Are there any other issues?

Any help would be great!

Upvotes: 1

Views: 338

Answers (3)

dpi
dpi

Reputation: 2006

I think it is a bad practice not to use C99 features where they are useful. C89 is long-obsolete, doing things like storing boolean values in ints or declaring all variables at the beginning of a function can be considered bad style now.

Forget about MSVC. MSVC is a C++ compiler and neither intended nor suitable for compiling C.

Upvotes: 1

Stephen Canon
Stephen Canon

Reputation: 106197

C99 is now 13 years old, and MS have made it clear repeatedly that they are not interested in modern C development in VS. Fortunately, there are several other compiler toolchains available for Windows, and those support C99 / C11 / future revisions of the standard.

There are some micro-controllers that lack C99 development tools, but you are probably not targeting them if you're doing "cross platform application" development. Essentially all mainstream platforms have one or more modern C compilers available to target, so you should be fine.

Upvotes: 3

ugoren
ugoren

Reputation: 16441

I'm pretty sure you can find a C99 compliant compiler for any reasonable platform.
So yes - go ahead and use C99.
Being standard-compliant is always good practice.

Upvotes: 3

Related Questions