C4503警告?我如何解决/摆脱他们? [英] C4503 warnings? How do i solve/get rid of them?

查看:744
本文介绍了C4503警告?我如何解决/摆脱他们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次尝试C ++ STL。我试图使用map构建一个多维关联数组。例如:

It's my first time trying out C++ STL. I'm trying to build a multidimensional associative array using map. For example:

typedef struct DA {
    string  read_mode;
    string  data_type;
    void    *pValue;
    void    *pVarMemLoc;
}DA;

int main()
{
    map<string, map<string, map<string, map<string, map<string, DA*>>>>> DATA;

    DATA["lvl1"]["stg1"]["flr1"]["dep1"]["rom1"] = new DA;
    DATA["lvl1"]["stg1"]["flr1"]["dep1"]["rom2"] = new DA;
    DATA["lvl1"]["stg1"]["flr1"]["dep1"]["rom3"] = new DA;

    IEC["lvl1"]["stg1"]["flr1"]["dep1"]["rom1"]->read_mode = "file";
    IEC["lvl1"]["stg1"]["flr1"]["dep1"]["rom2"]->read_mode = "poll";
    IEC["lvl1"]["stg1"]["flr1"]["dep1"]["rom3"]->read_mode = "report";

    return 0;
}

在VS2005中编译上面的代码时,我得到了170个C4503警告。
所有警告都是关于装饰名长度超过,名称被截断。
程序似乎运行良好,虽然。

When compiling the code above in VS2005, I got 170 of C4503 warnings. All of the warnings are about "decorated name length exceeded, name was truncated". The program seems to run fine though.

任何人都关心有一些时间来解释我是什么导致这些警告,我如何解决em?提前感谢:)

Anyone care to spare some time to explain to me what caused these warnings and how do i solve em? thanks in advance :)

Warning 1   warning C4503: 'std::map<_Kty,_Ty>::~map' : decorated name length exceeded, name was truncated  c:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h 2121
Warning 2   warning C4503: 'std::map<_Kty,_Ty>::map' : decorated name length exceeded, name was truncated   c:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h 2121
Warning 3   warning C4503: 'std::map<_Kty,_Ty>::operator []' : decorated name length exceeded, name was truncated   c:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h 2121
Warning 4   warning C4503: 'std::_Tree<_Traits>::~_Tree' : decorated name length exceeded, name was truncated   c:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h 2121
Warning 5   warning C4503: 'std::map<_Kty,_Ty>::operator []' : decorated name length exceeded, name was truncated   c:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h 2121
Warning 6   warning C4503: 'std::_Tree<_Traits>::iterator::~iterator' : decorated name length exceeded, name was truncated  c:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h 2121
Warning 7   warning C4503: 'std::_Tree<_Traits>::iterator::iterator' : decorated name length exceeded, name was truncated   c:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h 2121


推荐答案

如果你打算保留这个怪物的数据结构,可以对其他警告进行禁用:

If you intend to keep this monster of a data structure, there is little you can do about the warning other than disable it:

#pragma warning(disable:4503)

这篇关于C4503警告?我如何解决/摆脱他们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆