{"id":12955,"date":"2017-03-07T10:02:18","date_gmt":"2017-03-07T17:02:18","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=12955"},"modified":"2019-02-18T17:48:40","modified_gmt":"2019-02-18T17:48:40","slug":"c-standards-conformance-from-microsoft","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/c-standards-conformance-from-microsoft\/","title":{"rendered":"C++ Standards Conformance from Microsoft"},"content":{"rendered":"<p>Since we first shipped Visual Studio 2015 we\u2019ve talked a lot about <a href=\"https:\/\/devblogs.microsoft.com\/vcblog\/\/07\/msvc-the-best-choice-for-windows\">Microsoft Visual C++ compiler and library (MSVC)<\/a> conformance improvements in this blog. Our team has been focused on making MSVC the best compiler toolset for your development on Windows, and that starts with fully conforming to the existing C++ Standard. This post will look back on the progress we\u2019ve made in MSVC and look forward to our plans in the next version.<\/p>\n<p>We\u2019re not just implementing the C++ Standard, we\u2019re helping to develop it. The MSVC team is a major contributor to the development of the C++ Standard. In addition to our participation in the standards committee meeting, editors from three major Technical Specifications (Coroutines, <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2015\/12\/03\/c-modules-in-vs-2015-update-1\">Modules<\/a>, and Ranges) work on the MSVC team. We also maintain an <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/08\/23\/range-v3-on-msvc-is-available-on-github\">open source fork of the Ranges TS<\/a> that works on our compiler.<\/p>\n<h4>Creating a conforming toolset<\/h4>\n<p>In 2015 we started on a project that would fundamentally change how our compiler parses and analyzes code. We call this work <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2015\/09\/25\/rejuvenating-the-microsoft-cc-compiler\">\u201ccompiler rejuvenation,\u201d<\/a> a term that\u2019s used in Jim Springfield\u2019s excellent blog post from September 2015. We first shipped the rejuvenation work with VS 2015, but we\u2019re still working on it today. It\u2019s always been important for us to show value in our current compiler, maintain compatibility with existing code, and still prepare for a future where MSVC fully conforms to the standard.<\/p>\n<p>Our compiler conformance progress shows the benefits of both the rejuvenation work and other conformance work. We\u2019ve implemented almost all of the features introduced in the C++11 and C++14 standards. There are always bugs, of course, but only three feature areas remain unimplemented. We don\u2019t yet have two-phase name lookup from C++98, we don\u2019t have a conforming preprocessor, and we still have an incomplete implementation of Expression SFINAE.<\/p>\n<p>This progress reflects a huge investment across the compiler but we\u2019ve made especially big gains in <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/11\/16\/sfinae-update\">Expression SFINAE<\/a> as well as work on constexpr and extended constexpr: <a href=\"https:\/\/devblogs.microsoft.com\/vcblog\/\/02\/constexpr-and-aggregate-initialization\/\">our implementation now conforms to the C++14 rules about extended constexpr<\/a>. We very much appreciate our customers\u2019 eagerness to tell us where we still have issues. This was especially true with regards to constexpr, where <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/constexpr-we-need-your-input-2\">over 150 of you sent us code samples that showed us constexpr bugs<\/a> remaining in our compiler. All the code snippets your provided in the survey have been turned into test cases. They are all passing with the VS 2017 compiler.<\/p>\n<p>We\u2019ve also heard from you through <a href=\"https:\/\/connect.microsoft.com\/VisualStudio\/Feedback\/LoadSubmitFeedbackForm?FormID=6564\">Connect<\/a>, <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-2015\/category\/30937-languages-c\">User Voice<\/a>, <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio-2017\">Report a Problem in the IDE<\/a>, <a href=\"mailto:\/\/visualcpp@microsoft.com\">e-mail<\/a>, <a href=\"https:\/\/twitter.com\/visualc\">Twitter @visualc<\/a>, <a href=\"https:\/\/www.facebook.com\/Microsoft-Visual-Cpp-222043184527264\/\">Facebook at Microsoft Visual Cpp<\/a>, and many other channels. We\u2019ve <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/06\/07\/compiler-improvements-in-vs-2015-update-3-rc\">consistently fixed between 200 and 300 developer-reported bugs in each update<\/a>. Thank you for taking the time to help us identify issues!<\/p>\n<p>Fixing conformance bugs in our toolset inevitably requires some changes in your source code. It\u2019s not always easy to migrate all your code to new compiler features all at once. We introduced the <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/standards-version-switches-in-the-compiler\">standards version switches<\/a> last year that let you opt-in to using features from the latest draft standard (i.e., C++17). And we\u2019ve created a new conformance mode in the compiler, <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/11\/16\/permissive-switch\">\/permissive-<\/a>, that lets you opt into a mode that disables Microsoft-specific conformance issues. Lastly, we\u2019ve started to <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/10\/05\/visual-c-compiler-version\">update the <code>__MSC_VER<\/code> compiler version macro<\/a> with every compiler toolset update and the <code>__MSC_FULL_VER<\/code> macro with each build. This lets you test programmatically for exactly what version of the compiler is compiling your code.<\/p>\n<p>Some legacy bugs and non-standard behaviors in our compiler would have unintended runtime implications and incorrect behavior. Fixing those bugs in the default mode of the compiler is necessary in order to move the compiler forward towards conformance. When these changes are introduced, we <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/cpp-conformance-improvements-2017\">carefully track all of them and provide before\/after code snippets with recommendations and rationales for making the changes<\/a>.<\/p>\n<p>Sometimes, as with the <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2017\/01\/27\/yield-keyword-to-become-co_yield-in-vs-2017\">recent keyword changes made by the standards committee in the Coroutines TS<\/a>, we can\u2019t control required code changes. But we know that it\u2019s important to minimize any changes you have to make in your code when moving to a newer toolset.<\/p>\n<h4>Staying current with new features<\/h4>\n<p>We\u2019ve spent a lot of time on conformance issues, but we haven\u2019t just been catching up. We\u2019ve been implementing C++ 17 compiler features as time permits. We\u2019ve shipped a few draft standard features in the compiler and have another dozen queued up to release with the next update of VS 2017.\u00a0 Our goal is to complete implementation of the C++17 standard when the standard is approved by ISO. Our current plan is to finish features by the end of the calendar year 2017.<\/p>\n<p>We\u2019ve also continued to make good progress in <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/stl-fixes-in-vs-2017-rtm\">implementing library features as the standard develops<\/a>. You might remember that with VS 2015 Update 2 we were <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/01\/22\/vs-2015-update-2s-stl-is-c17-so-far-feature-complete\">feature complete for C++17 features approved at that point<\/a>. We expect to have all of the major C++17 library features implemented before the standard is published.<\/p>\n<p>Our first focus is on the remaining standards conformance features missing from MSVC. There are two big features still missing in MSVC: two-phase name lookup from C++98 and the C++ preprocessor from C++11. We also have significant work remaining on Expression SFINAE. We\u2019ve started implementation of two-phase name lookup under the new conformance mode, \/permissive-, and will preview two-phase name lookup support in mid-2017. And we have plans to start implementing a preprocessor that conforms to the standard. We\u2019re also looking forward to implementing the remaining C++17 features as well as some notable Technical Specifications such as Concepts.<\/p>\n<p>We maintain a <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/visual-cpp-language-conformance\">summary of compiler features and standard library features for the MSVC toolset<\/a>. You can use this list to track our progress as we implement C++17 language and library features.<\/p>\n<p>Beyond conformance, which we consider table stakes for a modern C++ compiler, we are also heavily and continually investing in codegen performance, security, build throughput, diagnostics and analysis so that we can be <a href=\"https:\/\/devblogs.microsoft.com\/vcblog\/\/07\/msvc-the-best-choice-for-windows\/\">the best compiler toolset on Windows<\/a>.<\/p>\n<h4>Conformance integration with the VS IDE<\/h4>\n<p>We have not only delivered conformance improvements in our compiler toolset, we&#8217;ve also made the same conformance changes in the VS C++ IDE. You might remember that we use a (<a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/11\/16\/permissive-switch\">separate compiler, EDG, for IDE productivity features<\/a>.) We carefully turn on behavior in EDG to match conformance fixes as they are made in our toolset.<\/p>\n<p>For example, here&#8217;s the Visual Studio 2017 showing <code>constexpr<\/code> evaluation when hovering over a variable in the editor:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/intellisense-for-conformance-improvements.png\"><img decoding=\"async\" width=\"300\" height=\"217\" class=\"alignnone size-medium wp-image-12975\" alt=\"intellisense-for-conformance-improvements\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/intellisense-for-conformance-improvements-300x217.png\" \/><\/a><\/p>\n<h4>Reference materials on <a href=\"https:\/\/docs.microsoft.com\/cpp\">docs.microsoft.com<\/a><\/h4>\n<p>You&#8217;ll find reference information about the <a href=\"https:\/\/docs.microsoft.com\/cpp\/cpp-conformance-improvements-2017\">conformance improvements in Visual C++ 2017<\/a>, our <a href=\"https:\/\/docs.microsoft.com\/cpp\/visual-cpp-language-conformance\">current compiler and library conformance status<\/a>, and places where our compiler still exhibits <a href=\"https:\/\/docs.microsoft.com\/cpp\/cpp\/nonstandard-behavior\">nonstandard behavior<\/a> on <a href=\"https:\/\/docs.microsoft.com\/cpp\">docs.microsoft.com<\/a>.<\/p>\n<h4>In closing<\/h4>\n<p>As always, we welcome your feedback. Feel free to send any comments through e-mail at <a>visualcpp@microsoft.com<\/a>, through <a href=\"https:\/\/twitter.com\/visualc\">Twitter @visualc<\/a>, or Facebook at <a href=\"https:\/\/www.facebook.com\/Microsoft-Visual-Cpp-222043184527264\/\">Microsoft Visual Cpp<\/a>.<\/p>\n<p>If you encounter other problems with MSVC in VS 2017 please let us know via the <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio-2017\">Report a Problem<\/a> option, either from the installer or the Visual Studio IDE itself. Track your feedback on the <a href=\"https:\/\/developercommunity.visualstudio.com\/index.html\">developer community portal<\/a>. For suggestions, let us know through <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-2015\/category\/30937-languages-c\">UserVoice<\/a>. Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since we first shipped Visual Studio 2015 we\u2019ve talked a lot about Microsoft Visual C++ compiler and library (MSVC) conformance improvements in this blog. Our team has been focused on making MSVC the best compiler toolset for your development on Windows, and that starts with fully conforming to the existing C++ Standard. This post will [&hellip;]<\/p>\n","protected":false},"author":312,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12955","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus"],"acf":[],"blog_post_summary":"<p>Since we first shipped Visual Studio 2015 we\u2019ve talked a lot about Microsoft Visual C++ compiler and library (MSVC) conformance improvements in this blog. Our team has been focused on making MSVC the best compiler toolset for your development on Windows, and that starts with fully conforming to the existing C++ Standard. This post will [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/12955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/312"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=12955"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/12955\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=12955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=12955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=12955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}