{"id":30113,"date":"2022-03-01T18:41:11","date_gmt":"2022-03-01T18:41:11","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=30113"},"modified":"2022-03-01T19:26:52","modified_gmt":"2022-03-01T19:26:52","slug":"execution-and-static-analysis-support-for-msvc-on-compiler-explorer","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/execution-and-static-analysis-support-for-msvc-on-compiler-explorer\/","title":{"rendered":"Execution and Static Analysis Support for MSVC on Compiler Explorer"},"content":{"rendered":"<p><a href=\"https:\/\/godbolt.org\/\">Compiler Explorer<\/a> is a popular resource for visualizing the assembly output of various compilers, trying out different compiler versions and flags, and testing many popular libraries.<\/p>\n<p>We&#8217;re pleased to announce that, as of today, code execution and static analysis are now available for MSVC on Compiler Explorer. Execution on CE has been one of our <a href=\"https:\/\/developercommunity.visualstudio.com\/t\/allow-code-execution-on-godboltorg-for-msvc-compil\/663829\">highest voted tickets on Developer Community<\/a>, so we hope many of you will find it useful. The static analysis tool provided is the same as offered in <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/microsoft-cpp-code-analysis-with-github-actions\/\">GitHub Actions<\/a> and in the IDE as <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/in-editor-code-analysis-in-visual-studio-2019-preview-2\/\">background code analysis<\/a>.<\/p>\n<p>To enable code execution, tick the &#8220;Execute the code&#8221; box in the &#8220;Output\u2026&#8221; menu. Now, every time the code is compiled, it will be run and the output will be displayed in the Output window.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1.png\"><img decoding=\"async\" class=\"aligncenter wp-image-30121 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1.png\" alt=\"Execute the code and compile to binary options highlighted in the output menu\" width=\"866\" height=\"308\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1.png 866w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1-300x107.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1-768x273.png 768w\" sizes=\"(max-width: 866px) 100vw, 866px\" \/><\/a><\/p>\n<p>To enable static analysis, select &#8220;Static Analysis&#8221; from the &#8220;Add tool\u2026&#8221; menu. Output from the tool will be written to a new Static Analysis window. You can find out more about our toolchain&#8217;s static analysis capabilities in our <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/code-quality\/code-analysis-for-c-cpp-overview?view=msvc-170\">code analysis documentation<\/a>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1-1.png\"><img decoding=\"async\" class=\"aligncenter wp-image-30122 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1-1.png\" alt=\"Static analysis highlighted in the add tool menu\" width=\"849\" height=\"311\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1-1.png 849w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1-1-300x110.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce1-1-768x281.png 768w\" sizes=\"(max-width: 849px) 100vw, 849px\" \/><\/a><\/p>\n<p>You can see the static analysis in action below.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce2.png\"><img decoding=\"async\" class=\"aligncenter wp-image-30128 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce2.png\" alt=\"Static analysis finding an issue with the code\" width=\"3838\" height=\"874\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce2.png 3838w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce2-300x68.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce2-1024x233.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce2-768x175.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce2-1536x350.png 1536w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2022\/03\/ce2-2048x466.png 2048w\" sizes=\"(max-width: 3838px) 100vw, 3838px\" \/><\/a><\/p>\n<p>A huge thanks to Matt Godbolt and Patrick Quist from the Compiler Explorer team for their support. On the Microsoft side, much of this work was done by Tim Myers and Dale Hirt.<\/p>\n<p>You can let us know what you think of the new support on Twitter <a href=\"https:\/\/twitter.com\/visualc\">@visualc<\/a> or in the comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compiler Explorer is a popular resource for visualizing the assembly output of various compilers, trying out different compiler versions and flags, and testing many popular libraries. We&#8217;re pleased to announce that, as of today, code execution and static analysis are now available for MSVC on Compiler Explorer. Execution on CE has been one of our [&hellip;]<\/p>\n","protected":false},"author":706,"featured_media":30121,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[270],"tags":[],"class_list":["post-30113","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement"],"acf":[],"blog_post_summary":"<p>Compiler Explorer is a popular resource for visualizing the assembly output of various compilers, trying out different compiler versions and flags, and testing many popular libraries. We&#8217;re pleased to announce that, as of today, code execution and static analysis are now available for MSVC on Compiler Explorer. Execution on CE has been one of our [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/30113","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\/706"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=30113"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/30113\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/30121"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=30113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=30113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=30113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}