C++ Team Blog
The latest in C++, Visual Studio, VS Code, and vcpkg from the MSFT C++ team
Latest posts
Announcing full support for a C/C++ conformant preprocessor in MSVC
Update June 8, 2021: The C11 and C17 announcement post has instructions on how to get the latest Windows SDK that works with the conformant preprocessor. We are excited to announce full support for a conformant preprocessor in the MSVC toolset starting with Visual Studio 2019 version 16.6 Preview 2. Since the original blog post announcing preprocessor conformance changes, we’ve come a long way and are now ready to announce the completion of the C/C++ conformant preprocessor and its move to a non-experimental, fully supported state via the switch. Alongside standard conformance, the preprocessor also suppor...
Doxygen and XML Doc Comment support
Whether you’re using Doxygen or XML Doc Comments, Visual Studio version 16.6 Preview 2 provides automatic comment stub generation as well as Quick Info, Parameter Help, and Member List tooltip support. Stub Generation By default, the stub generation is set to XML Doc Comments. The comment stub can be generated by typing a triple slash (///) or by using the documentation generation shortcut (Ctrl+/) above the function. XML Doc Comment Doxygen To switch to Doxygen, type “Doxygen” in the Ctrl+Q search box, or go to Tools > Options > Text Editor > C/C++ > > General, and choose your preferred doc...
IntelliSense Code Linter for C++
Introducing the IntelliSense Code Linter for C++; a preview of "as-you-type" code analysis with fixups. Try it out today in Visual Studio 2019 16.6 Preview 2.
More Spectre Mitigations in MSVC
In a previous blog post, Microsoft described the Spectre mitigations available under . These mitigations, while not significantly impacting performance, do not protect against all possible speculative load attacks, described in industry research as Load Value Injection. We are now adding two new switches and to provide a more complete mitigation of Spectre attacks based on loads for customers. These switches are only available on x86 and x64 platforms. What do the new switches do? The flag specifies compiler generation of serializing instructions for every load instruction. For most loads, this entails addin...
Analyze your builds programmatically with the C++ Build Insights SDK
We're happy to announce today the release of the C++ Build Insights SDK, a framework that gives you access to MSVC build time information via C and C++ APIs. To accompany this release, we are making vcperf open source on GitHub. Because vcperf itself is built with the SDK, you can use it as a reference when developing your own tools. We’re excited to see what sort of applications you’ll be building with the SDK, and we’re looking forward to receiving your feedback! Background Last November, we introduced vcperf and its Windows Performance Analyzer (WPA) plugin to help MSVC users understand their build times...
The Performance Benefits of Final Classes
The specifier in C++ marks a class or virtual member function as one which cannot be derived from or overriden. For example, consider the following code: If we attempt to write a new class which derives from `derived` then we get a compiler error: The specifier is useful for expressing to readers of the code that a class is not to be derived from and having the compiler enforce this, but it can also improve performance through aiding devirtualization. Devirtualization Virtual functions require an indirect call through the vtable, which is more expensive than a direct call due to interactions with b...
AVX2 floating point improvements in Visual Studio 2019 version 16.5
Visual Studio version 16.2 provided a number of improvements to C++ video game development through vector optimizations. Visual Studio version 16.5 builds on these changes to improve the performance of even more vector operations.
AVX-512 Auto-Vectorization in MSVC
In Visual Studio 2019 version 16.3 we added AVX-512 support to the auto-vectorizer of the MSVC compiler. This post will show some examples and help you enable it in your projects. What is the auto vectorizer? The compiler’s auto vectorizer analyzes loops in the user’s source code and generates vectorized code for a vectorization target where feasible and beneficial. For example, if I build the code above using cl.exe /O2 /fp:fast /arch:AVX2 targeting AVX2, I get the following assembly. The lines 11-15 are the vectorized loop using ymm registers. The lines 16-21 are to calculate the scalar value sum from vect...
Custom AI-Assisted IntelliSense for your team
As you’ve been editing code, you may have noticed IntelliCode’s starred recommendations in your autocompletion lists. Our previous IntelliCode blog post explains that these smarter suggestions were machine-learned over thousands of open sourced GitHub repos. Using community knowledge is great for public APIs like the Standard Library, but what if you want IntelliCode suggestions for your APIs and other libraries that wouldn’t commonly be found in open-source code? To address this, in Visual Studio 2019 version 16.5 Preview 3 you can now train custom IntelliCode models on your own codebases. This generates somethi...