What's up with the thousands of warnings in standard headers in MSVC -Wall?

后端 未结 6 599
既然无缘
既然无缘 2020-11-27 16:22

Some people seem to advise you use -Wall, but when I did it on a small test project which just has a main.cpp with some includes, I get 5800 warnings most of them in standar

6条回答
  •  甜味超标
    2020-11-27 16:47

    The Visual C++ /Wall enables all of the warnings that are disabled by default at /W4. As you've found out, there is a good reason why a lot of those warnings are disabled by default (thanks, compiler, for telling me you've added padding; I really appreciate it!). It's probably best just to use /W4 on Visual C++.

    Intel C++ is like this too (I don't know about other compilers that utilize the EDG frontend). If you set it at /W5, it spews out tons of informational messages. My personal favorite is that it warns you if the storage class specifier isn't at the beginning of a declaration (so, const static int is no go, but static const int is fine).

提交回复
热议问题