{"id":24297,"date":"2019-05-07T20:58:49","date_gmt":"2019-05-07T20:58:49","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=24297"},"modified":"2019-10-01T21:54:42","modified_gmt":"2019-10-01T21:54:42","slug":"new-code-analysis-quick-fixes-for-uninitialized-memory-c6001-and-use-before-init-c26494-warnings","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/new-code-analysis-quick-fixes-for-uninitialized-memory-c6001-and-use-before-init-c26494-warnings\/","title":{"rendered":"New code analysis quick fixes for uninitialized memory (C6001) and use before init (C26494) warnings"},"content":{"rendered":"<p><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">In the\u00a0<\/span><\/span><a class=\"Hyperlink SCXW8007995 BCX0\" href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun Underlined SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW8007995 BCX0\">latest Preview release<\/span><\/span><\/a><span class=\"TextRun Underlined SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW8007995 BCX0\">\u00a0of Visual Studio 2019<\/span><\/span><span class=\"TextRun Underlined SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW8007995 BCX0\">\u00a0version<\/span><\/span><span class=\"TextRun Underlined SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW8007995 BCX0\">\u00a016.1<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">, we\u2019ve added two\u00a0<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW8007995 BCX0\">quick fixes to the Code Analysis experience<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">\u00a0focused around\u00a0<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW8007995 BCX0\">uninitialized<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">\u00a0variable<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">\u00a0check<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">s<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">.<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">These quick fixes are available\u00a0<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">via the\u00a0<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">Quick Actions (<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">lightbulb<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">)<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">\u00a0menu on relevant lines, accessed by hovering over the line or squiggle, or by pressing Ctrl<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">+<\/span><\/span><span class=\"TextRun SCXW8007995 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW8007995 BCX0\">Period.<\/span><\/span><\/p>\n<p><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">The<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">\u00a0first<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">\u00a0release of Visual Studio 2019 brought\u00a0<\/span><\/span><a class=\"Hyperlink SCXW39025057 BCX0\" href=\"https:\/\/devblogs.microsoft.com\/cppblog\/in-editor-code-analysis-in-visual-studio-2019-preview-2\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun Underlined SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW39025057 BCX0\">in-editor code analysis<\/span><\/span><\/a><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">\u00a0and various\u00a0<\/span><\/span><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/c-productivity-improvements-in-visual-studio-2019-preview-2\/\"><span class=\"FieldRange SCXW39025057 BCX0\"><span class=\"TextRun Underlined SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun CommentStart SCXW39025057 BCX0\">C++ productivity improvements<\/span><\/span><\/span><\/a><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW39025057 BCX0\">, including a quick fix for the\u00a0<\/span><\/span><a class=\"Hyperlink SCXW39025057 BCX0\" href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/code-quality\/c26477?view=vs-2019\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun Underlined SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW39025057 BCX0\">NULL to nullptr rule<\/span><\/span><\/a><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">\u00a0and others. In implementing further\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW39025057 BCX0\">code analysis<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">quick fixes,\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">we are basing de<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">cisions\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">on the following criteria:\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">1)\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">the warning should have a low false positive rate; 2) the warning should be high-impact and have a\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW39025057 BCX0\">potentially significant<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">downside if not corrected; 3) the warning should have a relatively simple fix. Looking at the most feasible warnings,\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"ContextualSpellingAndGrammarError SCXW39025057 BCX0\">Preview<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">\u00a03 provides\u00a0<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">quick fixes for the following<\/span><\/span><span class=\"TextRun SCXW39025057 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW39025057 BCX0\">:<\/span><\/span><\/p>\n<h3 aria-level=\"2\"><span data-contrast=\"none\">C6001:\u00a0<\/span><span data-contrast=\"none\">u<\/span><span data-contrast=\"none\">sing uninitialized memory &lt;variable&gt;<\/span><\/h3>\n<p><span data-contrast=\"auto\">Visual Studio reports\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/code-quality\/c6001?view=vs-2019\"><span data-contrast=\"none\">w<\/span><span data-contrast=\"none\">arning C6001<\/span><\/a><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">when an uninitialized local variable is used before being assigned a value,\u00a0<\/span><span data-contrast=\"auto\">which can lead<\/span><span data-contrast=\"auto\">\u00a0to unpredictable results<\/span><span data-contrast=\"auto\">.<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">This warning may be fixed by a<\/span><span data-contrast=\"auto\">dd<\/span><span data-contrast=\"auto\">ing<\/span><span data-contrast=\"auto\">\u00a0empty curly braces so that the variable\/object is\u00a0<\/span><span data-contrast=\"auto\">value<\/span><span data-contrast=\"auto\">-initialized<\/span><span data-contrast=\"auto\">\u00a0(<\/span><span data-contrast=\"auto\">will be all zeros<\/span><span data-contrast=\"auto\">)<\/span><span data-contrast=\"auto\">.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-24299 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/05\/C6001QuickFix.gif\" alt=\"New Code Analysis quick fixes: C6001\" width=\"1146\" height=\"492\" \/><\/p>\n<p><span class=\"TextRun SCXW156219441 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW156219441 BCX0\">This warning and corresponding quick fix\u00a0<\/span><\/span><span class=\"TextRun SCXW156219441 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW156219441 BCX0\">are<\/span><\/span><span class=\"TextRun SCXW156219441 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW156219441 BCX0\">\u00a0enabled by<\/span><\/span><span class=\"TextRun SCXW156219441 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW156219441 BCX0\">\u00a0default\u00a0<\/span><\/span><span class=\"TextRun SCXW156219441 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW156219441 BCX0\">in<\/span><\/span><span class=\"TextRun SCXW156219441 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW156219441 BCX0\">\u00a0the Microsoft Native Minimum ruleset<\/span><\/span><span class=\"TextRun SCXW156219441 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW156219441 BCX0\">.<\/span><\/span><\/p>\n<h3><span class=\"TextRun SCXW98298216 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW98298216 BCX0\">C26494<\/span><\/span><span class=\"TextRun SCXW98298216 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW98298216 BCX0\">:<\/span><\/span><span class=\"TextRun SCXW98298216 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW98298216 BCX0\">\u00a0VAR_USE_BEFORE_INIT<\/span><\/span><\/h3>\n<p><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">This<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">warning<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">\u00a0goes\u00a0<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"AdvancedProofingIssue SCXW220678405 BCX0\">hand-in-hand<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">\u00a0with the previous one<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">\u00a0and is fixed in the same way<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">.\u00a0<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">However, while<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">\u00a0warning<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">C<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">6001 is generated where the uninitialized variable is used<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">,\u00a0<\/span><\/span><a class=\"Hyperlink SCXW220678405 BCX0\" href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/code-quality\/c26494?view=vs-2019\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun Underlined SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW220678405 BCX0\">warning C26494<\/span><\/span><\/a><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">shows up\u00a0<\/span><\/span><span class=\"TextRun SCXW220678405 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW220678405 BCX0\">where the variable is declared.<\/span><\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-24300 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2019\/05\/C26494QuickFix.gif\" alt=\"New Code Analysis quick fixes: CC26494\" width=\"1209\" height=\"401\" \/><\/p>\n<p><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">Note that this warning and corresponding quick fix\u00a0<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW192259146 BCX0\">are<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">\u00a0not enabled in the default ruleset, but\u00a0<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">rather<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">\u00a0under the\u00a0<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">C++ Core Check Type Rules.<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">To\u00a0<\/span><\/span><a class=\"Hyperlink SCXW192259146 BCX0\" href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/code-quality\/using-rule-sets-to-specify-the-cpp-rules-to-run?view=vs-2019\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun Underlined SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW192259146 BCX0\">change rulesets<\/span><\/span><\/a><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">\u00a0in\u00a0<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW192259146 BCX0\">a<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">n<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"SpellingError SCXW192259146 BCX0\">MSBuild<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">\u00a0project, navigate to Property Pages &gt; Code Analysis &gt; General;\u00a0<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW192259146 BCX0\">for projects using CMake, add the\u00a0<code>\"codeAnalysisRuleset\"<\/code> key into\u00a0<\/span><\/span><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">your\u00a0<\/span><\/span><a class=\"Hyperlink SCXW192259146 BCX0\" href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/cmakesettings-reference?view=vs-2019\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun Underlined SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW192259146 BCX0\">CMakeSettings.json<\/span><\/span><\/a><span class=\"TextRun SCXW192259146 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW192259146 BCX0\">\u00a0with the value set to the full path or the filename of a ruleset file.<\/span><\/span><\/p>\n<h3 aria-level=\"2\"><span data-contrast=\"none\">Send us feedback<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">Thank you to everyone\u00a0<\/span><span data-contrast=\"auto\">who helps make Visual Studio a better experience for all<\/span><span data-contrast=\"auto\">. Your<\/span><span data-contrast=\"auto\">\u00a0feedback is critical in ensuring we can deliver the best Code Analysis experience. We\u2019d love for you to download\u202f<\/span><a href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\"><span data-contrast=\"none\">Visual Studio 2019\u00a0<\/span><span data-contrast=\"none\">16.1\u00a0<\/span><span data-contrast=\"none\">Preview\u00a0<\/span><span data-contrast=\"none\">3<\/span><\/a><span data-contrast=\"auto\">, give it a try, and let us know how it\u2019s working for you in the comments below or\u00a0<\/span><a href=\"mailto:visualcpp@microsoft.com\"><span data-contrast=\"none\">via email<\/span><\/a><span data-contrast=\"auto\">. If you encounter problems or have\u00a0<\/span><span data-contrast=\"auto\">suggestion<\/span><span data-contrast=\"auto\">s<\/span><span data-contrast=\"auto\">,\u00a0<\/span><span data-contrast=\"auto\">please\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio?view=vs-2019\"><span data-contrast=\"none\">Report A Problem<\/span><\/a><span data-contrast=\"auto\">,<\/span><span data-contrast=\"auto\">\u00a0or<\/span><span data-contrast=\"auto\">\u00a0let us know<\/span><span data-contrast=\"auto\">\u00a0via\u202f<\/span><a href=\"https:\/\/developercommunity.visualstudio.com\/spaces\/62\/index.html\"><span data-contrast=\"none\">Visual Studio Developer Community<\/span><\/a><span data-contrast=\"auto\">. You can also find us on Twitter\u202f<\/span><a href=\"https:\/\/twitter.com\/visualc\"><span data-contrast=\"none\">@<\/span><span data-contrast=\"none\">VisualC<\/span><\/a><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the\u00a0latest Preview release\u00a0of Visual Studio 2019\u00a0version\u00a016.1, we\u2019ve added two\u00a0quick fixes to the Code Analysis experience\u00a0focused around\u00a0uninitialized\u00a0variable\u00a0checks.\u00a0These quick fixes are available\u00a0via the\u00a0Quick Actions (lightbulb)\u00a0menu on relevant lines, accessed by hovering over the line or squiggle, or by pressing Ctrl+Period. The\u00a0first\u00a0release of Visual Studio 2019 brought\u00a0in-editor code analysis\u00a0and various\u00a0C++ productivity improvements, including a quick fix for [&hellip;]<\/p>\n","protected":false},"author":1079,"featured_media":24299,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[270,230],"tags":[119],"class_list":["post-24297","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement","category-new-feature","tag-code-analysis"],"acf":[],"blog_post_summary":"<p>In the\u00a0latest Preview release\u00a0of Visual Studio 2019\u00a0version\u00a016.1, we\u2019ve added two\u00a0quick fixes to the Code Analysis experience\u00a0focused around\u00a0uninitialized\u00a0variable\u00a0checks.\u00a0These quick fixes are available\u00a0via the\u00a0Quick Actions (lightbulb)\u00a0menu on relevant lines, accessed by hovering over the line or squiggle, or by pressing Ctrl+Period. The\u00a0first\u00a0release of Visual Studio 2019 brought\u00a0in-editor code analysis\u00a0and various\u00a0C++ productivity improvements, including a quick fix for [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/24297","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\/1079"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=24297"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/24297\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/24299"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=24297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=24297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=24297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}