C11 and C17 Standard Support Arriving in MSVC



Please peek our Visible Studio 2019 model 16.8 Preview 3 inaugurate notes for more of our most unique parts.

Our personnel is pleased to relate that C11 and C17 have gotten supported language variations in the MSVC compiler toolset starting up with Visible Studio 2019 model 16.8 Preview 3!

For many years Visible Studio has finest supported C to the extent of it being required for C++. Issues are about to trade now that a conformant token-basically based preprocessor has been added to the compiler. With the arrival of two unique compiler switches, /std:c11 and /std:c17, we’re formally supporting essentially the most unique ISO C language requirements.

What’s in:

The total required parts of C11 and C17 are supported. This meant adding the following functionalities:

  • _Pragma
  • restrict
  • _Noreturn and
  • _Alignas, _Alignof and
  • _Generic and toughen
  • _Static_assert

IntelliSense works natively with these parts as neatly, merely utilize a .c file extension for your offer recordsdata or the /TC compiler swap to enable syntax highlighting for C code.

At the 2nd IntelliSense highlighting is finest available for the keywords and no longer the macros launched by the no longer contemporary headers. This may occasionally perhaps well even be fixed in a later inaugurate.

Since C17 is indubitably merely a computer virus repair inaugurate of ISO C, with many defect reports being adopted, our toughen for C11 already involves the total linked defect reports. At contemporary, there are seemingly to be no longer any differences between the C11 and C17 variations with the exception of for the __STDC_VERSION__ macro, which expands to 201112L (for C11) and 201710L (for C17).

Right here is an example that reveals these parts:


#elaborate NO_WARN(X)                                                  
    _Pragma("warning (push)") _Pragma("warning (disable: 4146)") X; 
    _Pragma("warning (pop)") 

// Preserve kept or storei according to the model of the dst 
#elaborate store(x, y) _Generic((x),               
                            records*: kept,      
                            int: storei)(x, y) 

typedef struct records {
    _Alignas(8) unsigned int i;
} records;

static_assert(alignof(records) == 8, "records is no longer neatly aligned");

void kept(recordsrestrict dst, const recordsrestrict src)
    // Catch no longer trigger warning 4245 
    dst->i = NO_WARN(-(src->i));


void storei(intrestrict dst, const intrestrict src)
    *dst = *src;

noreturn void my_exit(int ret) {

int predominant() {
    records src, dst;
    src.i = 5;

    int i, j;

    i = 10;

    store(&src, &dst);
    store(&i, &j);


For the explanation that inclusion of the token-basically based conformant preprocessor, the 2 unique C compiler switches suggest /Zc:preprocessor. At the same time as you could make utilize of the feeble, personality-basically based preprocessor alongside C11 or C17, you are going to should pass in the /Zc:preprocessor- compiler swap explicitly. We discontinue support you to repair your offer code where wished to no longer rely on the legacy, feeble preprocessor.

What’s no longer:

While there may be today no toughen for any C11 optionally available parts, we’re dedicated to providing essentially the most impactful optionally available parts in future releases. Atomic and threading toughen are on our roadmap. Pink meat up for Advanced numbers is today no longer planned and their absence is enforced with the precise goal test macros. Please hunch to Visible Studio Developer Neighborhood and bid your toughen for parts you could be implemented. We are looking for your enter that we’re making the precise prioritizations.
Due to the nature of the Windows heap, aligned_alloc toughen is lacking. The different is to make utilize of _aligned_malloc.

Additionally, DR 400 toughen is today unimplemented for realloc as this trade would spoil ABI.

Variable Length Arrays

Astute readers will ticket that VLAs are also no longer supported. Variable dimension arrays are on the total less atmosphere apt than comparable fixed sized arrays, and on the total inefficient in contrast to equivalent malloc(), when safely and securely implemented. VLAs provide attack vectors such as these of the immoral will get() — deprecated and destined to elimination — for opportunities of “gripping the stack” and various exploits. For these causes we intend no longer to toughen VLAs as an optionally available goal in C11.

C11 and C17: Getting Started

In screech to make utilize of C11 or C17 to your applications, essentially the most unique Windows SDK updates are required to work neatly with the conforming preprocessor (/Zc:preprocessor), and the unique Universal C Runtime. Windows SDK releases correspond with Windows OS releases. Since there changed into no Windows inaugurate with these changes, you are going to be wanting an Insider Preview Windows SDK – a preview model of the Windows SDK that corresponds with Windows builds today being flighted for Windows Insiders. Demonstrate that after inserting in the Insider Preview Windows 10 SDK, Visible Studio tasks configured to make utilize of essentially the most unique Windows SDK will utilize the Insider Preview.

Step 1: Log in with an Insider Microsoft Myth

Somebody can design a free Microsoft memoir (https://signup.dwell.com/) and then choose into the Insider program. Simply hunch to https://insider.residence windows.com/en-us/for-builders and click ‘Register’ and log in.

After registering, you are going to be given the option to inaugurate up flighting Insider variations of Windows, nonetheless here’s no longer major to download and utilize the Insider Windows 10 SDK. Registering does no longer robotically choose to your machines to download unique Windows flights.

At the same time as you hit this online page, you discontinue no longer should click ‘Flight now’. Proceed to the following step and download the Insider Preview Windows 10 SDK.

Step 2: Download the Insider Preview Windows 10 SDK

The Insider Preview Windows SDK can even be installed from https://www.microsoft.com/en-us/application-download/windowsinsiderpreviewSDK. If here’s no longer the accumulate page you receive, be wonderful you are logged in along with your Microsoft memoir that has been opted into being an Insider.

The Insider online page describes that using a Windows 10 Insider Preview OS is required. Right here is correct for one of the squawk material included in the Windows SDK, as they may perhaps well even merely rely on unique APIs no longer contemporary on older variations of Windows, nonetheless the Windows and Universal C Runtime headers will neatly install and be usable without an Insider OS.

Click on ‘Catch SDK Insider Preview – Catch 20206’ to inaugurate up download. Future variations of the Windows SDK can even work.

Step 3: Set up the Insider Preview Windows 10 SDK

The Insider Preview Windows SDK will download as an .iso file.

Mount the .iso file and drag WinSDKSetup.exe to inaugurate up set up.

Preserve to install the Windows Instrument Constructing Kit on this pc and click next. You may perhaps well presumably also resolve on to protect terminate whether to permit insights for Windows SDK usage and should settle for the license agreement before you reach at the goal set up online page. The suitable parts you could install (unless you are using an Insider Preview procure of Windows 10) are:

  • Windows SDK Signing Tools for Desktop Apps
  • Windows SDK for UWP Managed Apps
  • Windows SDK for UWP C++ Apps
  • Windows SDK for Desktop C++ x86 Apps (if planning on constructing for x86)
  • Windows SDK for Desktop C++ amd64 Apps (if planning on constructing for amd64)
  • Windows SDK for Desktop C++ arm Apps (if planning on constructing for arm)
  • Windows SDK for Desktop C++ arm64 Apps (if planning on constructing for arm64)

The SDK will pick a couple minutes to complete set up and then chances are high you’ll perhaps well presumably delivery Visible Studio 16.8 Preview 3.

Step 4: Configuring C11 or C17 mode in Visible Studio 16.8 Preview 3

Pink meat up for C11 and C17 begins in Visible Studio 16.8 Preview 3. You may perhaps well presumably download essentially the most unique Preview by technique of https://visualstudio.microsoft.com/vs/preview/.

To your project, delivery the Properties online page. First, we should be wonderful the project will utilize the Insiders Preview Window 10 SDK. Self-discipline Windows SDK Version to 10.0.20206.0 (or essentially the most unique Insider Preview Windows 10 SDK merely installed).

You may perhaps well even peek a brand unique option: C Language Celebrated. Self-discipline this to ISO C11 Celebrated (/std:c11) or ISO C17 (2018) Celebrated (/std:c17).

The C++ Language Celebrated is feeble when the language is C++ – this would perhaps well perhaps neatly be the default when the file extension is .cpp. The C Language Celebrated model is feeble when the language is C – this would perhaps well perhaps neatly be the default when the file extension is .c. To be wonderful the project is constructing with C11 or C17, you could be wonderful it is a .c file, or space the code to bring together as C in the Properties tab.

After these project changes, you’re ready to envision out C11 and C17!

In Conclusion

We are very indignant to at final toughen C11 and C17! Because the preferrred voted Developer Neighborhood suggestion, we’re wonderful you’re indignant too. At the same time as you desire toughen for the optionally available parts of C11, please permit us to clutch on Developer Neighborhood.

As repeatedly, we welcome your strategies. We are able to also be reached by technique of the comments below or by technique of e-mail (visualcpp@microsoft.com). At the same time as you come across complications with Visible Studio or MSVC, or have an provide for us, please permit us to clutch by plan of Aid > Ship Suggestions > Document A Assert / Provide a Recommendation in the product, or by technique of Developer Neighborhood. You may perhaps well presumably also additionally obtain us on Twitter (@VisualC).

Read More

Leave A Reply

Your email address will not be published.