A Year of C++ Improvements in Visual Studio, VS Code, and vcpkg
As we enter the new year, it’s a good time to look back at all the features and improvements we made for C++ developers in our tools in 2023. We’ve made advancements across Visual Studio, Visual Studio Code, our toolchain, and the vcpkg package manager in both performance and functionality. Some particular areas of focus have been ARM64 support, Unreal Engine development, code safety, and cross-platform development.
Cross-platform development is a first-class citizen in Visual Studio and has been for many years now. We’ve added many new features for those targeting Linux, Windows Subsystem for Linux, embedded platforms, and those using CMake for their builds.
- The Linux Integrated Terminal allows you to debug Linux applications with a fully-featured terminal experience directly inside Visual Studio.
You can now test and build multiple CMake Targets from the CMake Targets view.
Use the CMake Debugger to debug your CMake scripts like you would any other program. You can set breakpoints, see the values of CMake variables at the current point of execution, and more.
Use the Remote File Explorer to see a directory tree of the files on a remote system.
Import STM32CubeIDE projects with the new STM32CubeIDE Project Support.
Install Windows Subsystem for Linux automatically from Visual Studio with “Install WSL for Me”.
Remote Linux unit test support adds your remote Linux tests to the Test Explorer.
We want your development to be as fast and low-friction as possible. Our productivity features address this, giving you better ways to complete your day-to-day tasks.
Sticky Scroll gives you context for the current code location in your editor by sticking the top line of nested blocks to the top of the window.
Brace Pair Colorization lets you easily see matching brace pairs by making them the same color.
The new Spell Checker finds and corrects spelling issues in your code.
All-in-one Search joints together the code search and feature search functions into one tool.
Breakpoint groups let you organize breakpoints to make large collections easier to manage.
You can now compare files straight from the solution explorer with the File Comparison window.
Copy-paste with correct indentation makes it easier to accurately share code with others.
Parallel stack filtering lets you selectively display or hide specific threads or frames.
You can now see macro expansions step-by-step with Macro Expansion Visualization.
You can now create GitHub pull requests from Visual Studio.
Visualize complex, hierarchical compiler errors with structured diagnostics.
See size and alignment of types directly in the editor.
Use our new memory layout visualization tool for seeing how types will be stored in memory.
Optimize your #includes with #include directive cleanup.
Game development is a key area of focus for us, as game developers often have constraints and workflows which other C++ developers do not. Last year we focused especially on our Unreal Engine support.
Navigate your Unreal Engine Blueprints with the new Unreal Engine Blueprint References and Asset Inspector.
Use the Unreal Engine Log Viewer to see your UE logs directly in Visual Studio.
Edit HLSL shaders with improved HLSL editor integration.
Unreal Engine macro formatting ensures that your UE macros are handled appropriately by the autoformatter.
Use the Unreal Engine naming convention checker to ensure your code conforms to expectations.
Find all UE Blueprint references with a single command using Unreal Engine Blueprint Find All References.
The Unreal Engine test adapter adds your UE tests to the Test Explorer window.
Use Unreal Engine code snippets to quickly generate common UE-specific code.
Unreal Engine macro specifier suggestions gives you a quick description of UE macros without you having to leave your editor.
C++ Build Insights is a collection of tools that collect data about your C++ builds and present it in a format that can help you answer common questions, like:
- Are my builds sufficiently parallelized?
- What should I include in my pre-compiled header (PCH)?
- Is there a specific bottleneck I should focus on to increase my build speeds?
Last year, we integrated Build Insights into Visual Studio, letting you see details on how your #includes are affecting your builds:
We then added a Functions View for seeing the amount of time the compiler took to process specific functions:
As well as the performance of your code, we continue to work on the performance of Visual Studio itself. Here are some of the highlights.
- Improved time-to-open and time-to-close
- Improved time-to-colorization
- Improved debug launch performance
For conformance with the C and C++ standards, we added support for C11 atomics and threads. We also extended our C++20 support to C++/CLI projects. We also shipped the standard library modules which are available in both C++23 mode and C++20 mode (the latter is a cross-vendor extension).
You can see the STL changelog for full details of our advances on our open-source standard library. You can also see the live STL Status Chart to see where we’re at for standards conformance. At the time of writing, only 8 standard library features remain for C++23 conformance. Thank you to everyone who contributed features in the last year! Please continue to file issues and create pull requests on the GitHub repository; this is very much a community project.
We also open-sourced the IFC SDK for C++ Modules, which provides an interface for interacting with IFC files. IFC is an on-disk binary format which stores a representation of C++ source code for machine consumption. It was designed to implement C++ Modules, but can be used for other tools which require information about C++ code and don’t want to integrate a full C++ parser. The Microsoft Office Word codebase began adopting header units with MSVC, which you can read about in Integrating C++ header units into Office using MSVC.
Finally, we wrote extensive documentation for C++20 Ranges.
We’ve been working on the MSVC backend to improve code generation so that your C and C++ code runs as fast as possible. We’ve introduced new optimizations for ARM64 (particularly the auto-vectorizer for NEON instructions) as well as ones which will benefit all architectures (e.g. optimizations across basic blocks and vectorized loops). We also improved debug build performance by introducing new inlining controls for named type casts (like std::move and std::forward). Here are some blog posts which describe some of the bigger changes we’ve made in the past year:
- Improved debug build performance
- ARM64 optimizations
- Machine-independent optimizations
- More ARM64 optimizations
- Even more ARM64 optimizations!
Code safety has been one of our team’s key focuses for the past several years. In addition to improvements to our Address Sanitizer support and static analysis tools, we produced a set of guidelines on how to build reliable and secure C++ programs. This is a section-by-section companion to the United States government publication NISTIR 8397: Guidelines on Minimum Standards for Developer Verification of Software.
Here are blog posts on some of the key improvements we made:
- Key Events for use-after-move
- High-Confidence Lifetime Checks
- Several code analysis improvements
- Address Sanitizer support for std::string
- Address Sanitizer continue_on_error mode
- Address Sanitizer Runtime Unification
vcpkg is our free, cross-platform package manager for C and C++. Here are some of the main advancements we made in the last year:
- vcpkg Shipped with Visual Studio
- Documentation moved to Microsoft Learn
- Integration with the GitHub Dependency Graph
- Android tested triplets
- Default triplet is now detected from host
We have official Visual Studio Code extensions for C++, CMake, Makefiles, and Embedded. We also maintain a C/C++ Extension Pack, which collects some of these and other helpful extensions. We introduced many new features last year, most of them in response to issues filed on GitHub, so please keep sending in your feedback!
We introduced new Quick Fixes for missing header files – if there is an unknown symbol in your C++ code and the C/C++ Extension identifies the correct header file in your workspace, you will now have a quick fix available.
Use the new Call Hierarchy view to can easily navigate your codebase – especially to understand the complex calling relationships between functions. This was our most requested feature in 2023 and 3rd most requested feature of all time!
You can also now automatically extract code into a function – our 2nd most requested feature of 2023,and 10th most requested feature of all time!
We added a new, simpler C++ compiler acquisition process.
You can now automatically generate a function definition from a function declaration and vice versa with the Create Declaration/Definition feature.
You can also copy function declarations/definitions to the clipboard to customize where the declaration/definition is placed in your code. to the clipboard.
When commenting on your code, you can now use markdown to format your comments when using the hover tooltip.
Looking forward, we are focusing on performance, so keep an eye out in 2024 for new features for a faster, more efficient experience in the C/C++ Extension!
We added a Test Explorer for CTest which lets you view details of your tests and their latest results.
We added support for vcpkg portfile debugging.
As with Visual Studio, use the new CMake Debugger to debug your CMake scripts like you would any other program. You can set breakpoints, see the values of CMake variables at the current point of execution, and more.
Here are the videos for all our talks this past year at many conferences:
- Pure Virtual C++
- C++ Compiler Errors for Humans – Sy Brand
- Address Sanitizer continue_on_error – Jim Radigan
- Productive Cross-Platform and Game Development in Visual Studio – Sinem Akinci & David Li
- Build Time Reflection with C++ in Year 2023 – Gabriel Dos Reis
- Value Oriented Programming – Tony Van Eerd (guest)
- Lifetime Safety in C++ – Gabor Horvath
- New in Visual Studio: CMake Debugger, Better Diagnostics, and Video Games – David Li & Mryam Girmay
- Cooperative C++ Evolution: Towards a Typescript for C++ – Herb Sutter (Keynote)
- How Visual Studio Code Can Help You Develop More Efficiently in C++ – Alexandra Kemper & Sinem Akinci
- Getting Started with C++ – Michael Price
- Cracking Collaboration: Problems and Solutions for C++ Development – Sinem Akinci & Alexandra Kemper
- And Then() Some(T) – Victor Ciura
- Meeting C++
- AI Assistants for C++ Developers – Michael Price
- Swift ABI Resilience – Victor Ciura
- C++ on Sea
- C++ Mythbusters Strike 2 – Victor Ciura
- NDC Techtown
- C++ Mythbusters Strike 2 – Victor Ciura
Send us your feedback!
The comments below are open for us to track any requests. You can also find us on Twitter (@VisualC) or via email at email@example.com. To open a bug for Visual Studio, please see Visual Studio Feedback. To leave feedback for VS Code, visit the GitHub repository for the C++, CMake, Makefiles, or Embedded extension. We look forward to another year of C++!