Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable compiler warning C4503?

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.

I'm using Visual Studio 2008 on a Windows 7 machine.

like image 525
Chris Morris Avatar asked Mar 12 '12 19:03

Chris Morris


2 Answers

Not clear from the context, but maybe you have too many #pragma statements? MSDN says:

 The compiler only supports up to 56 #pragma warning statements in a compiland.
like image 117
Matthias Avatar answered Oct 09 '22 19:10

Matthias


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.

I should say I'm on VS2010 C++ Express edition.

like image 27
demoncodemonkey Avatar answered Oct 09 '22 21:10

demoncodemonkey