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

a 夏天 提交于 2019-11-30 08:52:36

问题


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


回答1:


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.

This code should then show error 6246:

#include <stdio.h>

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.



来源:https://stackoverflow.com/questions/10163942/how-do-i-enable-the-6000-series-warnings-code-analysis-warnings-in-msvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!