Archived

This topic is now archived and is closed to further replies.

xropi

vector<string> ?

Recommended Posts


        

#include "stdafx.h"


#include <vector>


#include <string>



using namespace std;

int main(int argc, char* argv[]) {

	vector<string>	x;

	return 0;
}
        
This tiny code forces MS VC6.0 to generate this warning list: --------------------Configuration: p1 - Win32 Debug-------------------- Compiling... p1.cpp c:\program files\microsoft visual studio\vc98\include\vector(48) : warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@IABV ?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@ABV?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information p:\test\p1\p1.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled c:\program files\microsoft visual studio\vc98\include\vector(61) : warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@PBV? $basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@0ABV?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information p:\test\p1\p1.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled c:\program files\microsoft visual studio\vc98\include\vector(103) : warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QA E?AV?$reverse_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information p:\test\p1\p1.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled c:\program files\microsoft visual studio\vc98\include\vector(105) : warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QB E?AV?$reverse_iterator@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information p:\test\p1\p1.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled c:\program files\microsoft visual studio\vc98\include\vector(107) : warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE? AV?$reverse_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information p:\test\p1\p1.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled c:\program files\microsoft visual studio\vc98\include\vector(108) : warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE? AV?$reverse_iterator@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information p:\test\p1\p1.cpp(12) : see reference to class template instantiation 'std::vector,class std::allocator >,class std::allocator,class std::allocator > > >' being compiled p:\test\p1\p1.cpp(15) : warning C4786: 'std::reverse_iterator,std::allocator > const *,std::basic_string,std::allocator >,std::basic_string,std::allocator > const &,std::basic_string,std::allocator > const *,int>' : identifier was truncated to '255' characters in the debug information p:\test\p1\p1.cpp(15) : warning C4786: 'std::reverse_iterator,std::allocator > *,std::basic_string,std::allocator >,std::basic_string,s td::allocator > &,std::basic_string,std::allocator > *,int>' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > > >::vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information c:\program files\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector,std::allocator >,std::allocator,std::allocator > > >::~vector,std::allocator >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information Linking... Creating browse info file... p1.exe - 0 error(s), 10 warning(s) IS this normal? What to do to avoid that? Ropi [edited by - xropi on November 7, 2002 10:03:49 PM]

Share this post


Link to post
Share on other sites
Yes, it''s perfectly normal for VC6. You can get rid of those warnings by putting ''#pragma warning(disable: 4786)'' before including the offending headers.

Share this post


Link to post
Share on other sites
Hmmm... I''m just wondering how can the guys @ Microsoft allow that... It''s very simple case not to discover.

Thx for your answer!
Ropi

Share this post


Link to post
Share on other sites
That warning is actually applicable to msvc as the linker only uses 255 characters to determine uniqueness. However, in practice it is completely useless and especially for STL as you have shown. I''d recommend turning it off, or moving up to msvc 7 .

Share this post


Link to post
Share on other sites
quote:
Original post by Premandrake
That warning is actually applicable to msvc as the linker only uses 255 characters to determine uniqueness.

s/linker/debugger

quote:
However, in practice it is completely useless and especially for STL as you have shown.

No, it''s not useless. You just haven''t discovered a use for it (yet). The MSVC 6 debugger has notoriously poor support for STL data structures, particularly sequential containers; it''s hard to view their elements or access their members (in the Watch window, for example), which results in developers using hacks like v._Front[6] to view the 7th element of a std::vector.

There was a CUJ article on stripping excess information (ie, compacting the type declaration) for STL entities in the MSVC 6 debugger, making it easier to decypher which types are giving problems ("std::string" vs "std::basic_string<char, charT, Allocator<char> >" and so forth).

Share this post


Link to post
Share on other sites