When STD: List is used, the compiler reports the following warning:
Warning c4786: 'std: reverse_bidirectional_iterator <STD: List <STD: basic_string <char, STD: char_traits <char>, STD: Allocator <char>, STD:: Allocator <STD: basic_string <char, STD: char_traits <char>, STD: alloca
Tor <char >>>:: iterator, STD: basic_string <char, STD: char_traits <char>, STD: Allocator <char>, STD :: basic_string <char, STD: char_traits <char>, STD: Allocator <char >>&, STD: basic_string <char, STD: char_traits <char>, STD :: allocator <char> *, int> ': iden
Tifier was truncated to '000000' characters in the debug information
This warning is generated because the identifier is too long and exceeds the limit of 255 characters. For example:
# Define a_really_long_class_name a_really_really_really_really_really_really_really_really _/
Really_really_really_really_really_really_really_really_really_really_really_really_really _/
Bytes
Class a_really_long_class_name
{
Public:
A_really_long_class_name (){};
Int m_data;
};
Void main ()
{
A_really_long_class_name test_obj;
Test_obj.m_data = 12;
}
If the class name exceeds 255 characters, 4786 Waring is reported during use. When using STL (C ++ Standard Template Library), it often causes similar errors, especially the template classes such as vector and map. The template contains a set of templates, which is too long if you are not careful. For example:
Template <Class A1, class A2, class A3, class A4>
Class verylongclassnamea {};Template <class B1, Class B2, class B3>
Class verylongclassnameb {};
Template <Class C1, Class C2>
Class verylongclassnamec {};
Template <class D1>
Class verylongclassnamed {};
Class somerandomclass {};
Typedef verylongclassnamed <somerandomclass> classd;
Typedef verylongclassnamec <somerandomclass, classd> classc;
Typedef verylongclassnameb <somerandomclass, classc, classd> classb;
Typedef verylongclassnamea <somerandomclass, classb, classc, classd> classa;
Void somerandomfunction (classa aobj ){}
Void main ()
{
Classa aobj;
Somerandomfunction (aobj );
}There are two solutions: one is to define the alias directly:# Ifdef _ debug
# Define verylongclassnamea
# Define verylongclassnameb
# Endif
The other is to block 4786 warning:# Pragma warning (Disable: 4786)Note that the blocking statement must be placed before the reference declaration of the error template class (for example, # include <vector>); otherwise, it still does not work.