C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

compile warnings in VC 6.0 using list<string>

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Rick Venter
Guest





PostPosted: Fri Apr 23, 2004 4:10 pm    Post subject: compile warnings in VC 6.0 using list<string> Reply with quote



I am trying to use list<string> and it gives me a compile time error
in VC 6.0

The following is the code snippet,

//this is in a .h file
class foo
{
public:
// Ensures only a single instance of this class is instantiated -
static foo* Instance();
// Dtor
virtual ~foo();

protected:
// Ctor. Clients cannot call this
foo() {};
private:
// only one of this is ever created
static foo *m_pCLMObj;
list<string> lst;
};


And the follwing is thw warning that I get

c:program filesmicrosoft visual studiovc98includelist(125) :
warning C4786: '?$reverse_bidirectional_iterator@Viterator@?$list@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@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@AAV43@PAV43@H'
: identifier was truncated to '255' characters in the browser
information
e:foo.h(15) : see reference to class template instantiation
'std::list<class std::basic_string std::char_traits,class
std::allocator<class std::b
asic_string std::allocator<char> > > >' being compiled
c:program filesmicrosoft visual studiovc98includelist(128) :
warning C4786: '?$reverse_bidirectional_iterator@Vconst_iterator@?$list@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@st
d@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@ABV43@PBV43@H'
: identifier was truncated to '255' characters in the browser
information
e:foo.h(15) : see reference to class template instantiation
'std::list<class std::basic_string std::char_traits,class
std::allocator<class std::b
asic_string std::allocator<char> > > >' being compiled

I cant seem to figure out what the matter is, can anyone help?

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Antoun Kanawati
Guest





PostPosted: Sat Apr 24, 2004 12:38 am    Post subject: Re: compile warnings in VC 6.0 using list<string> Reply with quote



The following are warnings, not errors, telling you about the
limitations of debug-mode. Basically, template instantiations
are creating mangles symbols that do not fit in some debugging
symbol table. If you compile in release-mode you will not see
these warnings.

You can switch them off with a pragma.

#pragma warning(disable: 4786)

After some trial and error, you'll get all your pragmas in the right
places, and the noise would go down to a decent level.

Rick Venter wrote:

Quote:
I am trying to use list<string> and it gives me a compile time error
in VC 6.0

The following is the code snippet,

//this is in a .h file
class foo
{
public:
// Ensures only a single instance of this class is instantiated -
static foo* Instance();
// Dtor
virtual ~foo();

protected:
// Ctor. Clients cannot call this
foo() {};
private:
// only one of this is ever created
static foo *m_pCLMObj;
list<string> lst;
};


And the follwing is thw warning that I get

c:program filesmicrosoft visual studiovc98includelist(125) :
warning C4786: '?$reverse_bidirectional_iterator@Viterator@?$list@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@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@AAV43@PAV43@H'
: identifier was truncated to '255' characters in the browser
information
e:foo.h(15) : see reference to class template instantiation
'std::list<class std::basic_string std::char_traits,class
std::allocator<class std::b
asic_string std::allocator<char> > > >' being compiled
c:program filesmicrosoft visual studiovc98includelist(128) :
warning C4786: '?$reverse_bidirectional_iterator@Vconst_iterator@?$list@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@st
d@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@ABV43@PBV43@H'
: identifier was truncated to '255' characters in the browser
information
e:foo.h(15) : see reference to class template instantiation
'std::list<class std::basic_string std::char_traits,class
std::allocator<class std::b
asic_string std::allocator<char> > > >' being compiled

I cant seem to figure out what the matter is, can anyone help?

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
moswald
Guest





PostPosted: Sat Apr 24, 2004 12:39 am    Post subject: Re: compile warnings in VC 6.0 using list<string> Reply with quote



In VC6, debug objects can't have identifiers longer than 255 characters.
In your case, you've got an item that, due to the template name mangling,
is very long. VC6 is just warning you that when you debug your program,
you won't be able to access any debug information about this object.

In VC7 this is not a problem (at least, it never has been in my
experience).

Your best bet is to just #pragma warning(disable:4786) the header.


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Ben Hutchings
Guest





PostPosted: Sat Apr 24, 2004 12:41 am    Post subject: Re: compile warnings in VC 6.0 using list<string> Reply with quote

Rick Venter wrote:
Quote:
I am trying to use list<string> and it gives me a compile time error
in VC 6.0
snip
And the follwing is thw warning that I get

c:program filesmicrosoft visual studiovc98includelist(125) :
warning C4786: '?$reverse_bidirectional_iterator@Viterator@?$list@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@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@AAV43@PAV43@H'
: identifier was truncated to '255' characters in the browser
information
snip
I cant seem to figure out what the matter is, can anyone help?

Your code is fine, but you have run into a compiler limitation. So
far as I know, you can safely disable this warning (using
#pragma warning).

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Eugene Gershnik
Guest





PostPosted: Wed Apr 28, 2004 7:44 pm    Post subject: Re: compile warnings in VC 6.0 using list<string> Reply with quote

moswald wrote:
Quote:
In VC6, debug objects can't have identifiers longer than 255
characters. In your case, you've got an item that, due to the
template name mangling, is very long. VC6 is just warning you that
when you debug your program, you won't be able to access any debug
information about this object.

This is not entirely correct. The warning tells exactly what happened - name
was truncated to 255 characters. You _will_ be able to debug and access
debug information. However, if you happen to have more than one symbol with
mangled names that differ only after 255 characters, the debugger may have
trouble displaying them. In practice I have never seen this to be a problem.
Template instantiations that usually result in this warning start to differ
well before 255 limit. Maybe it is possible to construct an artificial
example that will have a real problem but for all practical purposes the
warning can be safely ignored.

Quote:
Your best bet is to just #pragma warning(disable:4786) the header.

Agreed.

--
Eugene



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.