Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Q] - How to stop warning C4786 when defining a map

98 views
Skip to first unread message

Anthony Hill

unread,
Feb 10, 2002, 7:33:54 AM2/10/02
to
Hi all ,

Does anybody know how to stop the C4786 warning (symbol > 255 chars) when
defining a map?

I have the following test code;

#include <map>
#include <string>
class myClass
{
...
}

int main()
{
std::map< std::string , myClass* > myMap;

...
}

and it produces about 24 warnings. There is a bug which stops the #pragma
warning(disable:4786)
from working and I've tried typedef's and #defines to no avail. In my actual
code I'm getting > 1000
warnings which makes finding the errors a nightmare.

Any help gratefully appreciated

Thanks
Tony

Foo

unread,
Feb 10, 2002, 7:57:19 AM2/10/02
to
Add the following line before #include <map>
#pragma warning(disable: 4786)

Example:
#pragma warning(disable: 4786)
#include <map>
#include <string>

"Anthony Hill" <Mrantho...@btopenworld.com> wrote in message
news:a45pbi$2bg$1...@knossos.btinternet.com...

Anthony Hill

unread,
Feb 10, 2002, 8:55:07 AM2/10/02
to
There is a bug in VC6 and this pragma doesn't work


"Foo" <maiso...@home.com> wrote in message
news:P6u98.36172$X64.12...@news1.rdc2.pa.home.com...

Kevin Goodsell

unread,
Feb 10, 2002, 1:45:18 PM2/10/02
to
I doubt that. It works fine for me and I've never heard anyone else
complaining that it doesn't work, except those who later found that
they were using it incorrectly.

-Kevin

Anthony Hill

unread,
Feb 10, 2002, 4:51:49 PM2/10/02
to
This is the text from MSDN when I enter C4786 into search - I'm using VC++
6.0 - if yours
is OK and ideas what I might be missing?

BUG: C4786 Warning is Not Disabled with #pragma Warning
Last reviewed: April 24, 1997
Article ID: Q167355
The information in this article applies to:
Microsoft Visual C++, 32-bit Editions, version 5.0


SYMPTOMS
Warnings similar to the following are generated even if you use the warning
pragma to disable the warning:


warning C4786:
'std::rb_tree<CAiSpanningTree<State,std::less<State>>::TransClosureNode,
CAiSpanningTree<State,std::less<State>>::TransClosureNode,std::ident<Cai
SpanningTree<State,std::less<State>>::TransClosureNode,CAiSpanningTree<S
tate,std::less<State>>::TransClosureNode>,std::less<CAiSpanningTree<Stat
e,std::less<State>>::TransClosureNode>>' : identifier was truncated to
'255' characters in the debug information


The code:

#pragma warning(disable:4786)


disables warnings that list the file and line number. For example:

C:\test\Text.cpp(25) : warning C4786:


STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at
the beginning of this article. We are researching this bug and will post new
information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION
This warning can be ignored. However, the identifier may not be accessible
or viewable in the debugger.


"Kevin Goodsell" <good...@bridgernet.com> wrote in message
news:5vfd6ucaicup4hinh...@4ax.com...

Anthony Hill

unread,
Feb 10, 2002, 4:56:42 PM2/10/02
to
OK - very odd. I re-read the post from "foo" and saw he mentioned entering
the
#pragma before #include <map> so I tried that and now it is OK (I was
entering
the #pragma after the #include).
I'm fairly new at using VC so excuse the dumb question but how can I found
out if a bug listed
in MSDN has been fixed? It seems to me MSDN is out of sync with VC?


"Anthony Hill" <Mrantho...@btopenworld.com> wrote in message

news:a46q1l$ovr$1...@paris.btinternet.com...

Kevin Goodsell

unread,
Feb 10, 2002, 5:14:21 PM2/10/02
to
You said it was broken in Version 6, but the msdn article you quoted
referred to Version 5. I don't know about finding information on bug
fixes, except that I've seen some mentioned on the MS web pages that
describe the changes for each service pack. Probably the most up to
date knowledge base articles will tell you if a bug has been fixed -
these are available on the web site.

Whenever I have a C4786 warning pop up, I insert the #pragma at the
very top of the file, so it's before all #includes. This is because it
doesn't only apply to map<>, but can crop up with many of the STL
container classes.

-Kevin

On Sun, 10 Feb 2002 21:56:42 +0000 (UTC), "Anthony Hill"

0 new messages