Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Visual Studio 2017 fully support C99?

Recent versions of Visual Studio have seen improving support for C99. Does the latest version, VS2017, now support all of C99?

If not, what features of C99 are still missing?

like image 311
user200783 Avatar asked Feb 05 '18 02:02

user200783


People also ask

Does Visual Studio use C99?

By default, Microsoft's Visual Studio C Compiler doesn't follow the C99 standard. If you're using Visual Studio, you can make the transition process to Unix for the Lab Assignments easier by performing the following steps.

Is Visual Studio 2017 still supported?

Visual Studio 2017: mainstream support ends April 12, 2022, and the product will transition to extended support until April 2027. During extended support we'll provide fixes only for security issues. We recommend users move to the 15.9 supported baseline to remain under support.

What C standard does Visual Studio use?

The /std:c17 option enables ISO C17 conformance. It's available starting in Visual Studio 2019 version 16.8.

Does Visual Studio support C11?

Support for C11 and C17 standards is available in Visual Studio 2019 version 16.8 and later.


Video Answer


2 Answers

No.

https://docs.microsoft.com/en-us/cpp/visual-cpp-language-conformance

The compiler’s support for C99 Preprocessor rules is incomplete in Visual Studio 2017. Variadic macros are supported, but there are many bugs in the preprocessor’s behavior.

https://docs.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line

The Visual C++ C compiler is generally compatible with the ISO C99 standard, but not strictly compliant. In most cases, portable C code will compile and run as expected. Visual C++ does not support most of the changes in ISO C11. Certain library functions and POSIX function names are deprecated by the Visual C++ compiler. The functions are supported, but the preferred names have changed. For more information, see Security Features in the CRT and Compiler Warning (level 3) C4996.

Remember that Visual C++ is ultimately a C++ implementation and not a true C environment. The compatibility is a nice side-effect of C and C++’s shared heritage but despite superficial syntactical similarities the two are very different languages.

like image 67
Dai Avatar answered Sep 30 '22 19:09

Dai


Largely, yes, although some core language features are implemented non-compliantly (some with bugs and some are missing)

  • Variable Length Arrays are not supported (although these are now officially optional)
  • restrict qualifier is not supported, __restrict is supported instead, but it is not exactly the same
  • Top-level qualifiers in array declarations in function parameters are not supported (e.g. void foo(int a[const])) as well as keyword static in the same context

However, each new version of Visual Studio brings improvements in C99 support, so this work is not frozen apparently.

Answer to this question from 2015 has a number of relevant links, including MS roadmap for C support.

like image 41
AnT Avatar answered Sep 30 '22 17:09

AnT