是否可以禁用编译器警告C4503? [英] Is it possible to disable compiler warning C4503?
本文介绍了是否可以禁用编译器警告C4503?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码不会禁止任何C4503编译器警告,但是会禁止C4244警告.
The following code does NOT suppress ANY C4503 compiler warnings, but it does suppress C4244 warnings.
#pragma warning(push)
#pragma warning(disable:4503)
#pragma warning(disable:4244)
#include <map>
#include <string>
int main(int argc, char *argv[])
{
class Field;
typedef std::map<std::string, Field * > Screen;
typedef std::map<std::string, Screen> WebApp;
typedef std::map<std::string, WebApp> WebAppTest;
typedef std::map<std::string, WebAppTest> Hello;
Hello MyWAT; // The C4503 error is NOT suppressed
int a;
a = 5.0f; // The C4244 error is suppressed
}
#pragma warning(pop)
Please definitively explain why C4503 warnings are not suppressed. Note: it might be due to a similar reason as referenced in How can I work around warning C4505 in third party libraries?.
See this and this for more relevant infornation.
我正在Windows 7计算机上使用Visual Studio 2008.
I'm using Visual Studio 2008 on a Windows 7 machine.
推荐答案
有点奇怪,但是您可以通过删除#pragma warning(pop)
来使用确切的代码禁用此警告.我不明白为什么.
Bit weird but you can disable this warning using your exact code just by removing the #pragma warning(pop)
. I don't understand why though.
我应该说我正在使用VS2010 C ++ Express版.
这篇关于是否可以禁用编译器警告C4503?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文