使用 gcc 和 clang,我经常使用 -Wall -Wextra
警告标志.
With gcc and clang, I routinely use -Wall -Wextra
warning flags.
Visual C++ 2010(和更新版本,如果有差异)的哪些命令行开关会产生大致相同的结果?
What command line switches for Visual C++ 2010 (and newer, if there are differences) would produce about same result?
此 MSDN 文档页面提供了技术细节,但我根据实际经验从 Visual C++ 开发人员那里得到了更定性的答案:经验法则"标志,您可以在开始时安全地投入任何新项目,但仍会捕获大致相同的内容其他编译器的 -Wall -Wextra
捕获.
This MSDN document page provides the technical details, but I am after a more qualitative answer from Visual C++ developers, based on practical experience: A "rule of thumb" flags you can safely throw on any new project when you start, that would still catch approximately the same things that -Wall -Wextra
of the other compilers catch.
我同意@Paulius 的回答 这里 您在评论中链接到了./W4 将向您显示默认情况下未禁用的所有警告,这可能是您无需单独搜索每个警告并启用等效项即可获得的最接近大致相同的事物"的警告.MSVC 中的/Wall 将按照它所说的去做并打开所有警告(即使是有问题的警告),这对于任何重要的项目都会产生误报.这与 gcc -Wall 不同,后者只会打开不有问题"的警告.
I agree with @Paulius's answer here which you linked to in the comments. /W4 will show you all warnings that are not disabled by default, which is probably the closest you can get to "approximately the same things" without searching through each of the warnings individually and enabling the equivalent. /Wall in MSVC will do what it says and turn on all warnings (even the questionable ones), which for any non-trivial project will give false positives. This is different from gcc -Wall, which will only turn on warnings that are not "questionable".
这篇关于MSVC++ 警告标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!