程序中在使用list的时候,如 std::list(#include <list>),std::vector,map的时候,有时候会出现下列类似Warning;
我的程序使用的是std::list:
1 Warning:
d:/program files/microsoft visual studio/vc98/include/list(176) : warning C4786: '?rbegin@?$list@PAUMODULE_DESC_V2300tag@@V?$allocator@PAUMODULE_DESC_V2300tag@@@std@@@std@@QAE?AV?$reverse_bidirectional_iterator@Viterator@?$list@PAUMODULE_DESC_V2300t
ag@@V?$allocator@PAUMODULE_DESC_V2300tag@@@std@@@std@@PAUMODULE_DESC_V2300tag@@AAPAU4@PAPAU4@H@2@XZ' : identifier was truncated to '255' characters in the browser information
E:/XX.cpp(81) : see reference to class template instantiation 'std::list<struct MODULE_DESC_V2300tag *,class std::allocator<struct MODULE_DESC_V2300tag *> >' being compiled
d:/program files/microsoft visual studio/vc98/include/list(178) : warning C4786: '?rbegin@?$list@PAUMODULE_DESC_V2300tag@@V?$allocator@PAUMODULE_DESC_V2300tag@@@std@@@std@@QBE?AV?$reverse_bidirectional_iterator@Vconst_iterator@?$list@PAUMODULE_DESC_
V2300tag@@V?$allocator@PAUMODULE_DESC_V2300tag@@@std@@@std@@PAUMODULE_DESC_V2300tag@@ABQAU4@PBQAU4@H@2@XZ' : identifier was truncated to '255' characters in the browser information
E:/XX.cpp(81) : see reference to class template instantiation 'std::list<struct MODULE_DESC_V2300tag *,class std::allocator<struct MODULE_DESC_V2300tag *> >' being compiled
d:/program files/microsoft visual studio/vc98/include/list(180) : warning C4786: '?rend@?$list@PAUMODULE_DESC_V2300tag@@V?$allocator@PAUMODULE_DESC_V2300tag@@@std@@@std@@QAE?AV?$reverse_bidirectional_iterator@Viterator@?$list@PAUMODULE_DESC_V2300tag
@@V?$allocator@PAUMODULE_DESC_V2300tag@@@std@@@std@@PAUMODULE_DESC_V2300tag@@AAPAU4@PAPAU4@H@2@XZ' : identifier was truncated to '255' characters in the browser information
E:/XX.cpp(81) : see reference to class template instantiation 'std::list<struct MODULE_DESC_V2300tag *,class std::allocator<struct MODULE_DESC_V2300tag *> >' being compiled
d:/program files/microsoft visual studio/vc98/include/list(181) : warning C4786: '?rend@?$list@PAUMODULE_DESC_V2300tag@@V?$allocator@PAUMODULE_DESC_V2300tag@@@std@@@std@@QBE?AV?$reverse_bidirectional_iterator@Vconst_iterator@?$list@PAUMODULE_DESC_V2
300tag@@V?$allocator@PAUMODULE_DESC_V2300tag@@@std@@@std@@PAUMODULE_DESC_V2300tag@@ABQAU4@PBQAU4@H@2@XZ' : identifier was truncated to '255' characters in the browser information
E:/XX.cpp(81) : see reference to class template instantiation 'std::list<struct MODULE_DESC_V2300tag *,class std::allocator<struct MODULE_DESC_V2300tag *> >' being compiled
2 原因:
此warning产生的原因是因为标识符过长,超过了最大限定255个字。类名超过了255个字,使用时就会报4786的waring。在使用STL(C++标准模板库)的时候经常引发类似的错误,尤其是list,vector,map这类模板类,模板中套模板,一不小心就超长了。
3 解决方法:
#define TooLongClassNameA A
#define TooLongClassNameB B
#endif
3.2 屏蔽4786warning: