Microsoft’s Visual Studio IDE has added support for the C11 and C17 C language standards, thus expanding the IDE’s previously limited support for C. C11 and C17 become supported language versions starting with Visual Studio 2019 16.8 Preview 3, which was released September 14.
For years, Visual Studio has limited C support to whatever was required for the C++ language, which was built as an extension of C. Now, a conformant, token-based preprocessor has been added to the compiler. Two compiler switches,
/std:c17, were added to provide conformance to the latest ISO C standards.
C11 and C17 functionalities are supported such as
Static_assert. IntelliSense can work with these features by using a
.c file extension for source files or the
/TC compiler switch to enable syntax highlighting for C code.
However, IntelliSense highlighting is currently available for keywords only, not macros introduced by standard headers. A future release will fix this.
With the inclusion of the token-based conformant preprocessor, the two new C compiler switches imply /Zc:preprocessor. Developers who want to use the traditional character-based preprocessor alongside C11 or C17 will need to pass in the
/Zc:preprocessor- compiler switch.
Microsoft described C17 as a bug fix release of ISO C. The only differences between the C11 and C17 versions are the _
STDC_version macro in C17. While Visual Studio offers no support for C11 optional features, Microsoft plans to add the most impactful optional features in future releases. Atomic and threading support are on the product roadmap.
To use C11 and C17 in programs, developers must have the latest Insider Preview Windows SDK updates to work with the conforming preprocessor and the new Universal C runtime. Developers can create a free Microsoft account (https://signup.live.com) and then opt into the Insider program. Microsoft has posted a set of instructions for getting started with C11 and C17.
Visual Studio 2019 16.8 Preview 3 also offers improved support for C++ 20 across the compiler, standard library, and IDE. Modules, concepts, coroutines, and some ranges can be used in the same project.