Visual Studio 2022 17.14 accelerates the C++ compiler and brings MCP

Release 17.14 of Visual Studio 2022 brings numerous new features, especially for C++ developers.

listen Print view
C++ code

(Image: mki / heise online)

3 min. read
By
  • Manuel Masiero

In version 17.14 of Visual Studio 2022, the MSVC compiler generates code twenty percent faster than in version 17, according to Microsoft. Furthermore, the compiler simplifies the data flow so that the compilation time of an Unreal Engine/LTCG link repro should be reduced by thirteen percent. Microsoft has also hardened parts of the standard library to better detect undefined behavior at runtime.

Version 17.14 also offers new C++23 functions that can be added to the command line with the flags /std:c++latest or /std:c++23preview. The if consteval function, for example, distinguishes between compilation and runtime execution to select an optimized code path. An example from the Microsoft developer blog:

constexpr size_t strlen(char const* s) {
    if consteval {
        // if executed at compile time, use a constexpr-friendly algorithm
        for (const char *p = s; ; ++p) {
            if (*p == '\0') {
                return static_cast<std::size_t>(p - s);
            }
        }
    } else {
        // if executed at run time, use inline assembly
        __asm__("SSE 4.2 magic");
    }
}

Also, new are the static operator() and static operator[] functions, which enable more efficient and better structured function objects. In certain lambda expressions, it is possible to omit (). Microsoft provides a complete list of the C++ language updates for the MSVC compiler in the blog. The changelog lists all updates for the standard library.

Videos by heise

The new compiler and IDE function C++ Dynamic Debugging helps developers to debug optimized builds without losing the performance benefits of optimization. To achieve this, certain functions can be temporarily switched off to display optimized values. C++ Dynamic Debugging is currently still in preview status and is available in the MSVC toolset.

Some variables are not visible in optimized builds.

(Image: Microsoft)

With dynamic debugging, the debugger still displays the variables.

(Image: Microsoft)

GitHub Copilot's Agent Mode, which was introduced at the beginning of this year, enables multi-level and complex programming tasks to be completed using natural language. The agent mode still has preview status and can check code, detect and fix errors, suggest and execute terminal commands and analyze runtime errors.

Other new features for Copilot in version 17.14 include support for the Model Context Protocol (MCP), AI-supported comments and Next Edit Suggestion (NES). MCP provides Copilot with structured access to external AI tools, data, and resources and acts as a universal interface. After entering an expression for documentation (such as ///), the AI-supported comment function automatically completes the description of a code section based on its content.

Next Edit Suggestion makes suggestions for changes based on previous edits made by developers. Unlike code completion, NES suggests changes anywhere in the file where developers are most likely to need them.

The release notes for Visual Studio 2022 version 17.14 provide information on all new features. Visual Studio 17.14 is available for download here.

(olb)

Don't miss any news – follow us on Facebook, LinkedIn or Mastodon.

This article was originally published in German. It was translated with technical assistance and editorially reviewed before publication.