Visual Studio 2013 - Force C89

Oct 19, 2014 at 2:01am
Is there a way I can force Visual Studio 2013 to only compile C89 compliant C?
Oct 19, 2014 at 3:14am
Oct 19, 2014 at 3:39am
> Is there a way I can force Visual Studio 2013 to only compile C89 compliant C?

No. There is no way to target a particular version of the standard.

Use version 17.0 (Visual Studio 2012) and compile with /TC to get C89 (without the C95 revision).

Version 18.0 (Visual Studio 2013) compiles C89 with the C99 subset required for C++11.

Consider switching to another compiler if you need "serious" C.
C is a third class citizen in the Microsoft kingdom; tolerated to the extent required to support C++.

Our immediate and long-term goal is to fully support the C subsets of ISO C++.
...
We recommend that C developers use the C++ compiler to compile C code (using /TP if the file is named something.c). This is the best choice for using Visual C++ to compile C code.
...
If you really need either of the following:
features in C95/C99/C11 that are not part of ISO C++; or
features in C that are in the C++ subset but without also enabling the writing of C++ code;
then we recommend that you consider using a different compiler such as Intel or gcc (short-term) and/or pressure your standards committee representatives to have ISO C++ include more of the C standard (longer-term).

Sutter http://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/
Oct 19, 2014 at 10:28pm
@tmason I wasn't looking for a compiler (I'm using MSVC), I was just looking for a way to force a certain feature set. Thanks anyway though.

@JLBorges.
I often find myself accidentally using C99 features when I'd rather not, it's sad that I can't use a certain version of the C standard. I guess I'll have to just deal with it then. I'd rather not lose MS's powerful debugger.

Thanks, you've been very helpful.
Last edited on Oct 19, 2014 at 10:28pm
Oct 20, 2014 at 1:06am
The llvm toolchain can be used from Visual Studio; it integrates quite well with the Visual Studio debugger.
http://llvm.org/builds/

Microsoftisms extensions -fms-extensions are enabled by default; so you may want to turn them off.

Setting these additional options in Visual studio would enforce strict C89 conformance:
-std=c89 -fno-ms-extensions -Wall -Wextra -pedantic-errors
Topic archived. No new replies allowed.