How do I enable the 6000 series warnings (code analysis warnings) in MSVC++?

前端 未结 1 1167
闹比i
闹比i 2020-12-18 13:44

Even warning level 4 and \"all warnings\" does not make the 6000 series warnings appear.

1条回答
  •  离开以前
    2020-12-18 13:53

    Actually enabling these "Code Analysis" warnings has it's own dialog.

    In your project properties, you must check "Enable Code Analysis on Build" to make it work.

    code analysis

    This code should then show error 6246:

    #include 
    
    int main()
    {
      int x ;
    
      {
        int x = 6 ;
        printf( "%d\n", x ) ;
      }
    
    }
    
    warning C6246: Local declaration of 'x' hides declaration of the same name in outer scope.

    This setting appears to be completely independent of the "Configuration Properties/C/C++/General/Warning Level" setting in the properties dialog.

    setting doesnt matter

    0 讨论(0)
提交回复
热议问题