1

With gcc and clang, I routinely use -Wall -Wextra warning flags.

What command line switches for Visual C++ 2010 (and newer, if there are differences) would produce about same result?

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.

hyde
  • 50,653
  • 19
  • 110
  • 158
  • 1
    possible duplicate of [Best compiler warning level for C/C++ compilers?](http://stackoverflow.com/questions/399850/best-compiler-warning-level-for-c-c-compilers) – Mark Garcia Dec 04 '13 at 07:43
  • While answers of possible duplicate mostly deal with *gcc*, there seems to be one answer which is relevant to my question, even though it does not discuss the "catch approximately same things" part of my question: http://stackoverflow.com/a/399865/1717300 – hyde Dec 04 '13 at 08:25
  • 1
    I agree with @Paulius who you linked to. `/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. – Rastaban Dec 04 '13 at 22:56

1 Answers1

1

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".

Community
  • 1
  • 1
Rastaban
  • 811
  • 5
  • 8