标准库警告正常吗?
我目前正在学习视觉工作室的方法。如果我设置了/Wall
,尽管我的应用程序可以正常编译,但我会收到大量看似不健康的警告消息。
这是正常的吗?更改错误级别将停止消息。看起来好像它们都与 C++ STL 或其头文件相关 - 是一样的吗?
如果我使用 code::blocks (GCC) 构建程序,则尽管警告级别相同,但不会报告任何错误。
这是怎么回事?
更新: Visual Studio /Wall
输出:http://pastebin.com/FBGLd2Hb
Visual Studio < code>/W4 输出: http://pastebin.com/YuWKVS9G
代码实际上来自 Wrox专业C++。 我对“警告”一词的使用可能是错误的?
I'm learning my way around visual studio at the moment. If I've turned set /Wall
I'll be greeted with a seemingly unhealthy amount of warning messages although my application will compile just fine.
Is this normal? Changing the error level will stop the messages. It looks as if they are all related to the C++ STL or its header files - same thing?
If I build the program using code::blocks (GCC) then no errors are reported despite the same warning level.
What's going on here?
update:
visual studio /Wall
output: http://pastebin.com/FBGLd2Hb
visual studio /W4
output: http://pastebin.com/YuWKVS9G
The code is actually from Wrox Professional C++.
I could be wrong about my usage of the word warnings?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 g++
-Wall
不会打开所有警告,而只是打开一个实用的子集。我怀疑 MSVC/Wall
会打开比实际更多的警告。 MSVC 对警告非常热心。对于 MSVC,请使用
/W4
以获得高警告级别。您必须关闭 MSVC sillywarnings;您可以使用我的 anti-MSVC-sillywarnings 标头。
干杯&呵呵,,
With g++
-Wall
does not turn on all warnings, just a practical subset. I suspect that with MSVC/Wall
turns on more warnings than is practical. MSVC is very enthusiastic about warnings.With MSVC use
/W4
for high warning level.You'll have to turn off MSVC sillywarnings; you can use my anti-MSVC-sillywarnings header for that.
Cheers & hth.,