Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Visual Studio 2017 brings many updates and fixes to the C++ environment. We've fixed over 250 bugs and reported issues in the compiler and tools. Many were submitted by customers through the Report a Problem and Provide a Suggestion options under Send Feedback. Thank you for reporting bugs!
For more information on what's new in all of Visual Studio, see What's new in Visual Studio 2017. For information on what's new for C++ in Visual Studio 2019, see What's new for C++ in Visual Studio 2019. For information on what's new for C++ in Visual Studio 2015 and earlier versions, see Visual C++ What's New 2003 through 2015. For information about what's new in the C++ docs, see Microsoft C++ docs: What's new.
We've updated the C++ compiler and standard library in this release with enhanced support for C++11 and C++14 features. It also includes preliminary support for certain features expected to be in the C++17 standard. For detailed information, see C++ Conformance Improvements in Visual Studio 2017.
The compiler supports about 75% of the features that are new in C++17, including structured bindings, constexpr
lambdas, if constexpr
, inline variables, fold expressions, and adding noexcept
to the type system. These features are available under the /std:c++17
option. For more information, see C++ Conformance Improvements in Visual Studio 2017
The MSVC compiler toolset in Visual Studio version 15.7 now conforms with the C++ Standard. For more information, see Announcing: MSVC Conforms to the C++ Standard and Microsoft C/C++ language conformance.
The /experimental:preprocessor
compiler switch enables the new experimental MSVC preprocessor that will eventually conform to all applicable C and C++ standards. For more information, see MSVC new preprocessor overview.
/permissive-
: Enable all strict standards conformance compiler options and disable most Microsoft-specific compiler extensions (but not __declspec(dllimport)
, for example). This option is on by default in Visual Studio 2017 version 15.5. The /permissive-
conformance mode includes support for two-phase name lookup. For more information, see C++ Conformance Improvements in Visual Studio.
/diagnostics
: Enables display of the diagnostic error or warning location three different ways: just the line number, the line number and column, or the line number and column, with a caret under the offending line of code.
/debug:fastlink
: Enable up to 30% faster incremental link times (vs. Visual Studio 2015) by not copying all debug information into the PDB file. The PDB file instead points to the debug information for the object and library files used to create the executable. See Faster C++ build cycle in VS "15" with /Debug:fastlink
and Recommendations to speed C++ builds in Visual Studio.
Visual Studio 2017 allows using /sdl
with /await
. We removed the /RTC
limitation with Coroutines.
/std:c++14
and /std:c++latest
: These compiler options enable you to opt in to specific versions of the ISO C++ programming language in a project. Most of the new draft standard features are guarded by the /std:c++latest
option.
/std:c++17
enables the set of C++17 features implemented by the compiler. This option disables compiler and standard library support for features after C++17: ones that are changed or new in later versions of the Working Draft, and defect updates of the C++ Standard. To enable those features, use /std:c++latest
.
This release brings several improvements in optimization, code generation, toolset versioning, and diagnostics. Some notable improvements include:
/guard:cf
now guards switch statements that generate jump tables./await
option) was removed. Your code should be updated to use co_yield
instead. For more information, see yield
keyword to become co_yield
in VS 2017.Improvements to diagnostics in the compiler. For more information, see Diagnostic Improvements in Visual Studio 2017 15.3.0.
Visual C++ runtime performance continues to improve through better generated code quality. Now you can just recompile your code, and your app runs faster. Some of the compiler optimizations are brand new, such as the vectorization of conditional scalar stores, the combining of calls sin(x)
and cos(x)
into a new sincos(x)
, and the elimination of redundant instructions from the SSA optimizer. Other compiler optimizations are improvements to existing functionality, such as: vectorizer heuristics for conditional expressions, better loop optimizations, and float min/max codegen. The linker has a new and faster /OPT:ICF
implementation, which can result in up to 9% link-time speedups, and there are other perf fixes in incremental linking. For more information, see /OPT (Optimizations) and /INCREMENTAL (Link Incrementally).
The Microsoft C++ compiler supports Intel's AVX-512. It has Vector Length instructions that bring new functions in AVX-512 to 128-bit and 256-bit wide registers.
The /Zc:noexceptTypes-
option can be used to revert to the C++14 version of noexcept
while using C++17 mode in general. This option enables you to update your source code to conform to C++17 without having to rewrite all your throw()
code at the same time. For more information, see Dynamic exception specification removal and noexcept.
/Zc:__cplusplus
, enables correct reporting of the C++ standard support. For example, when the switch is set and the compiler is in /std:c++17
mode the value expands to 201703L
. For more information, see MSVC now correctly reports __cplusplus.basic_string
_ITERATOR_DEBUG_LEVEL != 0
diagnostics improvements. When an IDL check gets tripped in string machinery, it now reports the specific behavior that caused the trip. For example, instead of "string iterator not dereferencable" you get "cannot dereference string iterator because it is out of range (e.g. an end iterator)".std::promise
move assignment operator, which previously could cause code to block forever.atomic<T*>
implicit conversion to T*
.pointer_traits<Ptr>
now correctly detects Ptr::rebind<U>
.const
qualifier in the move_iterator
subtraction operator.propagate_on_container_copy_assignment
and propagate_on_container_move_assignment
.atomic<T>
now tolerates overloaded operator&()
.bind()
calls.There are more standard library improvements in Visual Studio 2017 RTM. For a complete list, see the C++ Team Blog entry Standard Library Fixes In VS 2017 RTM.
max_size()
to numeric_limits<difference_type>::max()
rather than the max()
of size_type
. This change ensures that the result of distance()
on iterators from that container is representable in the return type of distance()
.auto_ptr<void>
.for_each_n()
, generate_n()
, and search_n()
algorithms previously failed to compile if the length argument wasn't an integral type. They now attempt to convert nonintegral lengths to the iterators' difference_type
.normal_distribution<float>
no longer emits warnings inside the standard library about narrowing from double to float.basic_string
operations that used npos
instead of max_size()
when checking for maximum size overflow.condition_variable::wait_for(lock, relative_time, predicate)
would wait for the entire relative time if there was a spurious wake. Now it waits for only a single interval of the relative time.future::get()
now invalidates the future
, as the standard requires.iterator_traits<void *>
used to be a hard error because it attempted to form void&
; it now cleanly becomes an empty struct to allow use of iterator_traits
in "is iterator" SFINAE conditions.-Wsystem-headers
were fixed.-Wmicrosoft-exception-spec
.noexcept
(as our standard library never intends to throw an exception when detecting the non-propagate_on_container_swap
non-equal-allocator undefined behavior condition).vector<bool>
operations are now marked noexcept
.value_type
(in C++17 mode) with an opt-out escape hatch.basic_string
would scramble the strings contents. (Note: self-range-insert into vectors is still prohibited by the Standard.)basic_string::shrink_to_fit()
is no longer affected by the allocator's propagate_on_container_swap
.std::decay
now handles abominable function types, that is, function types that are cv-qualified, ref-qualified, or both./W4
clean, but doesn't attempt to be /Wall
clean. Many off-by-default warnings are unusually noisy, and aren't intended to be used on a regular basis.)std::list
debug checks. List iterators now check operator->()
, and list::unique()
now marks iterators as invalidated.tuple
.std::partition
now calls the predicate N
times instead of N + 1
times, as the standard requires.std::atomic<T>
no longer requires T
to be default constructible.__declspec(allocator)
is now guarded for C1XX only, to prevent warnings from Clang, which doesn't understand this declspec.basic_string::npos
is now available as a compile time constant.std::allocator
in C++17 mode now properly handles allocation of over-aligned types, that is, types whose alignment is greater than max_align_t
, unless disabled by /Zc:alignedNew-
. For example, vectors of objects with 16-byte or 32-byte alignment are now properly aligned for SSE and AVX instructions.apply()
, make_from_tuple()
.shared_ptr::weak_type
, and <cstdalign>.constexpr
in min(initializer_list)
, max(initializer_list)
, and minmax(initializer_list)
, and min_element()
, max_element()
, and minmax_element()
.For more information, see Microsoft C/C++ language conformance.
dynamic_pointer_cast()
and rethrow_if_nested()
inherently require dynamic_cast
, so the standard library now marks them as =delete
under /GR-
./GR-
, "static RTTI" in the form of typeid(SomeType)
is still available, and powers several standard library components. The standard library now supports disabling this feature too, via /D_HAS_STATIC_RTTI=0
. This flag also disables std::any
, the target()
and target_type()
member functions of std::function
, and the get_deleter()
friend member function of std::shared_ptr
and std::weak_ptr
.constexpr
unconditionally, instead of conditionally defined macros.nullptr
internally, instead of nullptr_t{}
. (Internal usage of NULL is eradicated. Internal usage of 0-as-null is being cleaned up gradually.)std::move()
internally, instead of stylistically misusing std::forward()
.static_assert(false, "message")
to #error message
. This change improves compiler diagnostics because #error
immediately stops compilation.__declspec(dllimport)
. Modern linker technology no longer requires it._Rng_abort()
, which called fputs()
to stderr
. This function's implementation is kept for binary compatibility. We'll remove it in the next binary-incompatible version of the standard library.all_of
any_of
for_each
for_each_n
none_of
reduce
replace
replace_if
sort
copy
copy_n
fill
fill_n
move
reverse
reverse_copy
rotate
rotate_copy
swap_ranges
<memory_resource>
polymorphic_allocator
assignment<filesystem>
std::launder()
std::byte
hypot(x,y,z)
constexpr char_traits
For more information, see Microsoft C/C++ language conformance.
basic_string::find(char)
overloads only call traits::find
once. Previously, it was implemented as a general string search for a string of length 1.basic_string::operator==
now checks the string's size before comparing the strings' contents.basic_string
, which was difficult for the compiler optimizer to analyze. For all short strings, calling reserve
still has a nonzero cost to do nothing.std::vector
was overhauled for correctness and performance: aliasing during insert and emplace operations is now correctly handled as required by the Standard, the strong exception guarantee is now provided when required by the Standard via move_if_noexcept()
and other logic, and insert and emplace do fewer element operations.weak_ptr::lock()
performance.std::string
and std::wstring
move constructors by more than three times.noexcept
, which prevented inlining the std::atomic
implementation into functions that use Structured Exception Handling (SEH)._Deallocate()
function to optimize into smaller code, allowing it to be inlined into more places.std::try_lock()
to use pack expansion instead of recursion.std::lock()
deadlock avoidance algorithm to use lock()
operations instead of spinning on try_lock()
on all the locks.system_category::message()
.conjunction
and disjunction
now instantiate N + 1
types, instead of 2N + 2
types.std::function
no longer instantiates allocator support machinery for each type-erased callable, improving throughput and reducing .obj size in programs that pass many distinct lambdas to std::function
.allocator_traits<std::allocator>
contains manually inlined std::allocator
operations, reducing code size in code that interacts with std::allocator
through allocator_traits
only (that is, in most code).allocator_traits
directly, instead of wrapping the allocator in an internal class _Wrap_alloc
. This change reduces the code size generated for allocator support, improves the optimizer's ability to reason about standard library containers in some cases, and provides a better debugging experience (as now you see your allocator type, rather than _Wrap_alloc<your_allocator_type>
in the debugger).allocator::reference
, which allocators aren't allowed to customize. (Allocators can make containers use fancy pointers but not fancy references.)basic_string
internal shrink path for shrink_to_fit()
and reserve()
is no longer in the path of reallocating operations, reducing code size for all mutating members.basic_string
internal grow path is no longer in the path of shrink_to_fit()
.basic_string
mutating operations are now factored into non-allocating fast path and allocating slow path functions, making it more likely for the common no-reallocate case to be inlined into callers.basic_string
mutating operations now construct reallocated buffers in the preferred state rather than resizing in place. For example, an insert at the beginning of a string now moves the content after the insertion exactly once. It's moved either down or to the newly allocated buffer. It's no longer moved twice in the reallocating case, first to the newly allocated buffer and then down.errno
address to remove repeated interaction with TLS.is_pointer
implementation.struct
and void_t
-based.std::vector
move assignment is now more efficient in the non-POCMA non-equal-allocator case, by reusing the buffer when possible.basic_string<char16_t>
now engages the same memcmp
, memcpy
, and similar optimizations that basic_string<wchar_t>
engages.lower_bound(iter, iter, function pointer)
.includes
, set_difference
, set_symmetric_difference
, and set_union
was reduced by unwrapping iterators before checking order.std::inplace_merge
now skips over elements that are already in position.std::random_device
no longer constructs and then destroys a std::string
.std::equal
and std::partition
had a jump-threading optimization pass that saves an iterator comparison.std::reverse
is passed pointers to trivially copyable T
, it now dispatches to a handwritten vectorized implementation.std::fill
, std::equal
, and std::lexicographical_compare
were taught how to dispatch to memset
and memcmp
for std::byte
and gsl::byte
(and other char-like enums and enum classes). Since std::copy
dispatches using is_trivially_copyable
, it didn't need any changes.Vcpkg is an open-source command-line tool that greatly simplifies the process of acquiring and building open-source C++ static libs and DLLS in Visual Studio. For more information, see vcpkg.
The CPPRestSDK, a cross-platform web API for C++, is updated to version 2.9.0. For more information, see CppRestSDK 2.9.0 is available on GitHub.
/Zc:threadSafeInit-
in your Project settings if you don't want thread-safe initialization.Several C++ operations that use the IntelliSense engine for refactoring and code navigation run much faster. The following numbers are based on the Visual Studio Chromium solution with 3500 projects:
Feature | Performance Improvement |
---|---|
Rename | 5.3x |
Change Signature | 4.5x |
Find All References | 4.7x |
C++ now supports Ctrl+Click Go To Definition, making mouse navigation to definitions easy. The Structure Visualizer from the Productivity Power Tools pack is now also included in the product by default.
The new SQLite-based database engine is now being used by default. The new engine speeds up database operations like Go To Definition and Find All References. It significantly improves initial solution parse time. The setting moved to Tools > Options > Text Editor > C/C++ > Advanced. (It was formerly under ...C/C++ > Experimental.)
We've improved IntelliSense performance on projects and files not using precompiled headers - an Automatic Precompiled Header is created for headers in the current file.
We've added error filtering and help for IntelliSense errors in the error list. Clicking on the error column now allows for filtering. Also, clicking on the specific errors or pressing F1 launches an online search for the error message.
Added the ability to filter Member List items by kind.
Added a new experimental Predictive IntelliSense feature that provides contextually aware filtering of what appears in the Member List. For more information, see C++ IntelliSense Improvements - Predictive IntelliSense & Filtering.
Find All References (Shift+F12) now helps you get around easily, even in complex codebases. It provides advanced grouping, filtering, sorting, searching within results, and (for some languages) colorization, so you can get a clear understanding of your references. For C++, the new UI includes information about whether we're reading from or writing to a variable.
The Dot-to-Arrow IntelliSense feature moved from experimental to advanced, and is now enabled by default. The editor features Expand Scopes and Expand Precedence moved from experimental to advanced.
The experimental refactoring features Change Signature and Extract Function are now available by default.
Added an experimental 'Faster project load' feature for C++ projects. The next time you open a C++ project it will load faster, and the time after that it will load much faster!
Some of these features are common to other languages, and some are specific to C++. For more information about these new features, see Announcing Visual Studio "15" Preview 5.
Visual Studio 2017 introduces the Open Folder feature. It enables you to code, build, and debug in a folder containing source code without the need to create any solutions or projects. Now it's simpler to get started with Visual Studio, even if your project isn't an MSBuild-based project. Open Folder gives you access to powerful code understanding, editing, building, and debugging capabilities. They're the same ones that Visual Studio already provides for MSBuild projects. For more information, see Open Folder projects for C++.
Visual Studio 2017 introduces support for using CMake projects without converting to MSBuild project files (.vcxproj). For more information, see CMake projects in Visual Studio. Opening CMake projects with Open Folder automatically configures the environment for C++ editing, building, and debugging.
C++ IntelliSense works without the need to create a CppProperties.json file in the root folder. We added a new dropdown to allow users to easily switch between configurations provided by CMake and CppProperties.json files.
Further configuration is supported via a CMakeSettings.json file that sits in the same folder as the CMakeLists.txt file.
We now provide a more granular installation experience for installing the original C++ workload. We added selectable components that enable you to install just the tools that you need. The indicated installation sizes for the components listed in the installer UI are incorrect, and underestimate the total size.
To successfully create Win32 projects in the C++ desktop workload, you must install both a toolset and a Windows SDK. Install the recommended (selected) components VC++ 2017 v141 toolset (x86, x64) and Windows 10 SDK (10.0.nnnnn) to make sure it works. If the necessary tools aren't installed, projects won't be created successfully, and the wizard stops responding.
The Visual C++ Build tools (previously available as a standalone product) are now included as a workload in the Visual Studio Installer. This workload installs only the tools required to build C++ projects without installing the Visual Studio IDE. Both the v140 and v141 toolsets are included. The v141 toolset contains the latest improvements in Visual Studio 2017 version 15.5. For more information, see Visual Studio Build Tools now include the VS2017 and VS2015 MSVC Toolsets.
The popular extension Visual C++ for Linux Development is now part of Visual Studio. This installation provides everything you need to develop and debug C++ applications running on a Linux environment.
Improvements were made in cross-platform code sharing and type visualization. For more information, see Linux C++ improvements for cross-platform code sharing and type visualization.
Use the full power of C++ to build professional games powered by DirectX or Cocos2d.
You can now create and debug mobile apps using Visual Studio that can target Android and iOS.
C++ comes as an optional component for the Universal Windows App workload. Currently, you must upgrade C++ projects manually. You can open a v140-targeted Universal Windows Platform project in Visual Studio 2017. However, you need to select the v141 platform toolset in the project property pages if you don't have Visual Studio 2015 installed.
You now have new options for writing and packaging C++ applications for the Universal Windows Platform and the Windows Store: The Desktop Bridge infrastructure lets you package your existing desktop application or COM object for deployment through the Windows Store. Or, for deployment through your existing channels via side-loading. New capabilities in Windows 10 enable you to add UWP functionality to your desktop application in various ways. For more information, see Desktop Bridge.
A Windows Application Packaging Project project template is added, which greatly simplifies packaging of desktop applications with Desktop Bridge. It's available under File | New | Project | Installed | Visual C++ | Universal Windows Platform. For more information, see Package an app by using Visual Studio (Desktop Bridge).
When writing new code, you can now use C++/WinRT, a standard C++ language projection for the Windows Runtime implemented solely in header files. It allows you to consume and author Windows Runtime APIs using any standards-conformant C++ compiler. C++/WinRT is designed to provide C++ developers with first-class access to the modern Windows API. For more information, see C++/WinRT.
Starting in build 17025 of the Windows SDK Insider Preview, C++/WinRT is included in the Windows SDK. For more information, see C++/WinRT is now included the Windows SDK.
The Clang/C2 toolset that ships with Visual Studio 2017 now supports the /bigobj
switch, which is crucial for building large projects. It also includes several important bug fixes, both in the compiler front-end and back-end.
The C++ Core Checkers for enforcing the C++ Core Guidelines are now distributed with Visual Studio. Enable the checkers in the Code Analysis Extensions page in the project's property pages. The extensions are then included when you run code analysis. For more information, see Using the C++ Core Guidelines checkers.
New C++ Core Guidelines checks cover smart pointer correctness, correct use of global initializers, and flagging uses of constructs like goto
and bad casts.
Some warning numbers you might find in 15.3 are no longer available in 15.5. These warnings were replaced with more specific checks.
/analyze:ruleset
, which lets you specify the code analysis rules to run.Google Test Adapter and Boost.Test Adapter are now available as components of the Desktop Development with C++ workload. They're integrated with Test Explorer. CTest support is added for CMake projects (using Open Folder), although full integration with Test Explorer isn't available yet. For more information, see Writing unit tests for C/C++.
Boost.Test
dynamic library support.Boost.Test
item template is now available in the IDE.For more information, see Boost.Test
Unit Testing: Dynamic Library support and New Item Template.
CodeLens support added for C++ unit test projects. For more information, see Announcing CodeLens for C++ Unit Testing.
Visual Studio Graphics Diagnostics tools: You can use them to record and analyze rendering and performance problems in Direct3D apps. Use them on apps that run locally on your Windows PC, in a Windows device emulator, or on a remote PC or device.
Input & Output for Vertex and Geometry shaders: The ability to view input and output of vertex shaders and geometry shaders has been one of the most requested features. It's now supported in the tools. Select the VS or GS stage in the Pipeline Stages view to start inspecting its input and output in the table below.
Search and filter in the object table: Provides a quick and easy way to find the resources you're looking for.
Resource History: This new view provides a streamlined way of seeing the entire modification history of a resource as it was used during the rendering of a captured frame. To invoke the history for any resource, click the clock icon next to any resource hyperlink.
It displays the new Resource History tool window, populated with the change history of the resource.
You can capture frames with full call stack capturing enabled. That lets you quickly deduce the context of each change event, and inspect it within your Visual Studio project. Set the full stack capture option in the Visual Studio Tools > Options dialog under Graphics Diagnostics.
API Statistics: View a high-level summary of API usage in your frame. It's handy for discovering calls you might not realize you're making at all, or calls you're making too often. This window is available via View > API Statistics in Visual Studio Graphics Analyzer.
Memory Statistics: View how much memory the driver allocates for the resources you create in the frame. This window is available via View > Memory Statistics in Visual Studio Graphics Analyzer. To copy data to a CSV file for viewing in a spreadsheet, right-click and choose Copy All.
Frame Validation: The new errors and warnings list provides an easy way to navigate your event list based on potential issues detected by the Direct3D debug layer. Click View > Frame Validation in Visual Studio Graphics Analyzer to open the window. Then click Run Validation to start the analysis. It can take several minutes to complete, depending on the frame's complexity.
Frame Analysis for D3D12: Use Frame Analysis to analyze draw-call performance with directed "what-if" experiments. Switch to the Frame Analysis tab and run analysis to view the report.
GPU Usage Improvements: Open traces can be taken via the Visual Studio GPU Usage profiler with either GPUView or the Windows Performance Analyzer (WPA) tool for more detailed analysis. If you have the Windows Performance Toolkit installed, there are two hyperlinks: one for WPA and another for GPUView, at the bottom right of the session overview.
Traces you open in GPUView via this link support synchronized VS and GPUView timeline zooming and panning. A checkbox in VS controls whether synchronization is enabled or not.
Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization