{"id":1884,"date":"2019-02-02T17:32:47","date_gmt":"2019-02-02T16:32:47","guid":{"rendered":"http:\/\/www.nuonsoft.com\/blog\/?p=1884"},"modified":"2019-02-02T17:32:49","modified_gmt":"2019-02-02T16:32:49","slug":"visual-studio-2019-preview-2-improvements","status":"publish","type":"post","link":"https:\/\/www.nuonsoft.com\/blog\/2019\/02\/02\/visual-studio-2019-preview-2-improvements\/","title":{"rendered":"Visual Studio 2019 Preview 2 Improvements"},"content":{"rendered":"\n<p>The recently released Preview 2 of Microsoft Visual Studio 2019 contains quite a few improvements and new features.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lifetime Profile Checker<\/h2>\n\n\n\n<p>Preview 2 includes a Lifetime Profile Checker that implements the Lifetime Profile as published by the <a rel=\"noreferrer noopener\" aria-label=\"C++ Core Guidelines (opens in a new tab)\" href=\"https:\/\/github.com\/isocpp\/CppCoreGuidelines\/blob\/master\/docs\/Lifetime.pdf\" target=\"_blank\">C++ Core Guidelines<\/a>. It includes:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Support for iterators, string_views, and spans.<\/li><li>Better detection of custom Owner and Pointer types which allows custom types that behave like Containers, Owning-Pointers, or Non-Owning Pointers to participate in the analysis.<\/li><li>Type-aware default rules for function call pre and post conditions help reduce false-positives and improve accuracy.<\/li><li>Better support for aggregate types.<\/li><li>General correctness and performance improvements.<\/li><li>Some simple nullptr analysis.<\/li><\/ul>\n\n\n\n<p>This feature is not enabled by default, but you can enable it in the code analysis ruleset for your project. An example of what this checker can catch is the following in which we have a dangling string_view:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\nstd::string get_string();\nvoid dangling_string_view()\n{\n    std::string_view sv = get_string();\n    auto c = sv.at(0);\n}\n<\/pre><\/div>\n\n\n<p>You can read more about this feature <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2019\/01\/24\/lifetime-profile-update-in-visual-studio-2019-preview-2\/\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Backend Updates: New Optimizations, OpenMP, and Build Throughput improvements<\/h2>\n\n\n\n<p>New features include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Added a new inlining command line switch: -Ob3. -Ob3 is a more aggressive version of -Ob2.<\/li><li>Added basic support for OpenMP SIMD vectorization.<\/li><li>Added a new C++ exception handler __CxxFrameHandler4 that reduces exception handling metadata overhead by 66%.<\/li><li>Support for Short Vector Math Library (SVML) intrinsic functions.<\/li><\/ul>\n\n\n\n<p>New and improved optimizations include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Useless struct\/class copies are being removed in several more cases,  including copies to output parameters and functions returning an object.  This optimization is especially effective in C++ programs that pass  objects by value.<\/li><li>Unrolled memsets and block initializations will now use SSE2 instructions (or AVX instructions if allowed).<\/li><li>The compiler recognizes memmove() as an intrinsic function and optimizes accordingly.<\/li><li>Several new scalar fused multiply-add (FMA) patterns are identified with \/arch:AVX2 \/fp:fast.<\/li><\/ul>\n\n\n\n<p>Preview 2 also improves build throughput. Link times might be improved up to 2x.<\/p>\n\n\n\n<p>The new linker will now report potentially matched symbol(s) for unresolved symbols, like:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmain.obj : error LNK2019: unresolved external symbol _foo referenced in function _main\n  Hint on symbols that are defined and could potentially match:\n    &quot;int __cdecl foo(int)&quot; (?foo@@YAHH@Z)\n    &quot;bool __cdecl foo(double)&quot; (?foo@@YA_NN@Z)\n    @foo@0\n    foo@@4\nmain.exe : fatal error LNK1120: 1 unresolved externals\n<\/pre><\/div>\n\n\n<p>More details can be found on <a rel=\"noreferrer noopener\" aria-label=\"this blog post (opens in a new tab)\" href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2019\/01\/24\/msvc-backend-updates-in-visual-studio-2019-preview-2\/\" target=\"_blank\">this blog post<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Template IntelliSense Improvements<\/h2>\n\n\n\n<p>The following updates for <strong>Template IntelliSense<\/strong> are included with Preview 2:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Peek Window UI<\/li><li>Live Edits<\/li><li>Nested Template support<\/li><li>Default Argument watermarks<\/li><\/ul>\n\n\n\n<p>Read all about it on <a rel=\"noreferrer noopener\" aria-label=\"this blog post (opens in a new tab)\" href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2019\/01\/24\/template-intellisense-improvements-for-visual-studio-2019-preview-2\/\" target=\"_blank\">this blog post<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">C++ Productivity Improvements<\/h2>\n\n\n\n<p>Preview 2 comes with the following new <strong>quick fixes<\/strong> and <strong>code navigation<\/strong> improvements:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Quick fixes for:<ul><li>Add missing #include<\/li><li>NULL to nullptr<\/li><li>Add missing semicolon<\/li><li>Resolve missing namespace or scope<\/li><li>Replace bad indirection operands (* to &amp; and &amp; to *)<\/li><\/ul><\/li><li>Quick Info on closing brace<\/li><li>Peek Header \/ Code File<\/li><li>Go to Document on #include<\/li><\/ul>\n\n\n\n<p>Read more about this new features <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2019\/01\/24\/c-productivity-improvements-in-visual-studio-2019-preview-2\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">New Code Analysis Checks<\/h2>\n\n\n\n<p>Preview 2 includes new code analysis checks:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Use-after-move checker<\/li><li>Coroutine related checkers<\/li><\/ul>\n\n\n\n<p>Read more about them <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2019\/01\/28\/new-code-analysis-checks-in-visual-studio-2019-use-after-move-and-coroutine\/\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">In-editor Code Analysis Improvements<\/h2>\n\n\n\n<p>Code analysis now runs automatically in the background, and warnings  display as green squiggles in-editor. Analysis re-runs every time you  open a file in the editor and when you save your changes.<\/p>\n\n\n\n<p>Squiggles are improved. Squiggles are now only displayed underneath the code segment that is relevant to the warning.<\/p>\n\n\n\n<p>Read more <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2019\/01\/24\/in-editor-code-analysis-in-visual-studio-2019-preview-2\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\">here<\/a>.<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The recently released Preview 2 of Microsoft Visual Studio 2019 contains quite a few improvements and new features. Lifetime Profile Checker Preview 2 includes a Lifetime Profile Checker that implements the Lifetime Profile as published by the C++ Core Guidelines. It includes: Support for iterators, string_views, and spans. Better detection of custom Owner and Pointer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,16],"tags":[41,236,237],"class_list":["post-1884","post","type-post","status-publish","format-standard","hentry","category-c","category-microsoft","tag-visual-studio","tag-visual-studio-2019","tag-vs2019"],"_links":{"self":[{"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/posts\/1884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/comments?post=1884"}],"version-history":[{"count":5,"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/posts\/1884\/revisions"}],"predecessor-version":[{"id":1889,"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/posts\/1884\/revisions\/1889"}],"wp:attachment":[{"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/media?parent=1884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/categories?post=1884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nuonsoft.com\/blog\/wp-json\/wp\/v2\/tags?post=1884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}