C++ Team Blog
The latest in C++, Visual Studio, VS Code, and vcpkg from the MSFT C++ team
Latest posts
Finding Bugs with AddressSanitizer: Patterns from Open Source Projects
AddressSanitizer (ASan) was officially released in Visual Studio 2019 version 16.9. We recently used this feature to find and fix a bug in the MSVC compiler itself. To further validate the usefulness of our ASan implementation, we also used it on a collection of widely used open source projects where it found bugs in Boost, Azure IoT C SDK, and OpenSSL. In this article, we present our findings by describing the type of bugs that we found and how they presented themselves in these projects. We provide links to the GitHub commits where these bugs were fixed so you can get a helpful look at what code changes were in...
2x-3x Performance Improvements for Debug Builds
We have made substantial runtime performance improvements in the x86/x64 C++ compiler for Visual Studio's default debug configuration. For Visual Studio 2019 version 16.10 Preview 2, we measure 2x - 3x speedup for programs compiled in debug mode. These improvements come from reducing the overhead introduced by runtime checks (/RTCs) which are enabled by default. Default debug configuration When you compile your code in debug configuration in Visual Studio, there are some flags that are passed to the C++ compiler by default. Most relevant to this blog post are /RTC1, /JMC and /ZI. While all of these flags...
Ignoring Automatic Initialization for Code Analysis
Reading uninitialized memory is one of the major sources of security vulnerabilities in C and C++ programs. Microsoft developed many tools to find such errors including compiler warnings, static analysis checks, and more recently: code instrumentation. For a more detailed overview of uninitialized memory related vulnerabilities and mitigations please refer to Microsoft Security Response Center’s great blog post. This blog post summarizes the potential interactions between code analysis and code instrumentation and improvements we've made in Visual Studio 2019 version 16.9.1. When we turn on the automatic ini...
Pure Virtual C++ 2021 is Today
Pure Virtual C++, a free one-day virtual conference for the whole C++ community, is starting today (May 3rd) at 14:30 UTC. You can watch it and interact with the speakers at Learn TV. There'll be sessions on C++20 modules, CMake, vcpkg, and code analysis. All of our pre-conference demos, including what's new in C++20 support in MSVC, are now live on YouTube. Hope to see you there!
Pure Virtual C++ 2021 Schedule Available
The schedule for Pure Virtual C++ 2021 is now live on the event website. Remember to sign up to be the first to access our extra on-demand C++ demos and get more virtual surprises. Schedule All times are on Monday 3rd May 2021 UTC. Abstracts and speaker bios are available on the website.
CMake Presets integration in Visual Studio and Visual Studio Code
CMakePresets.json was released in CMake 3.19 and 3.20 and allows users to specify common configure, build, and test options and share them with others. We have added support for CMakePresets.json in Visual Studio and the CMake Tools extension for Visual Studio Code. You can now invoke CMake with the same CMakePresets.json file in Visual Studio, in Visual Studio Code, in a Continuous Integration pipeline, and from the CLI on Windows, Linux, and macOS. Our CMake Presets integration is now available in preview in Visual Studio 2019 version 16.10 Preview 2 and CMake Tools version 1.7. Why should I use CMake Prese...
Visual Studio Code C++ Extension April 2021 Update: CUDA C/C++ IntelliSense and Apple Silicon Support
The April 2021 update of the Visual Studio Code C++ extension is now available! This latest release offers brand new features—such as IntelliSense for CUDA C/C++ and native language server support for Apple Silicon— along with a bunch of enhancements and bug fixes. To find out more about all the enhancements, check out our release notes on GitHub. CUDA C/C++ IntelliSense We’re excited to announce that the C++ extension now provides IntelliSense for CUDA C/C++! CUDA is a parallel programming platform, enabling developers to interact with the GPU. Microsoft and NVIDIA have partnered together to light up the CUD...
MSVC Backend Updates in Visual Studio 2019 version 16.10 Preview 2
In Visual Studio 2019 version 16.10 Preview 2 we have continued to improve the C++ backend with new features, new and improved optimizations, build throughput improvements, and better security. Here is a brief list of improvements for you to review. Do you want to experience the new improvements of the C++ backend? Please download the latest Visual Studio 2019 and give it a try! Any feedback is welcome. We can be reached via the comments below, D...
Finding Bugs with AddressSanitizer: MSVC Compiler
Special thanks to Aaron Gorenstein for authoring this blog post. The AddressSanitizer (ASan) is generally available for MSVC since the recently-released Visual Studio 2019 version 16.9. We’ve already shown how easy it can be to find bugs in even production-ready code like EASTL. Here I’ll share an example of how it found a real bug in the MSVC compiler itself. The idea was straightforward: ASan finds bugs, and we’re always interested in finding bugs in the compiler. Just like you can turn ASan on in your projects and run your tests, we’ve been turning on ASan on our project (the compiler) and running it on...