Warning C4786 
Author Message
 Warning C4786

I know this is mentioned in a number of MSDN articles, but I none of them
have proven satisfactory.

Does anyone know how to disable the Warning C4786 messages I get when using
STL with VC 6. I've tried placing:

#pragma warning( disable : C4786)

in my code, but it doesn't do anything.

This is a HUGE problem for me. With some of our source files we are getting
upwards of 550 warnings PER FILE! Not only does this slow the compile
process down immensely, but it also hides real and useful warning messages
under a storm of useless and unimportant warnings. A compiler that generates
too many warnings might as well generate none at all (since there's no easy
way to remove the C4786 warnings from the list). And a compiler that
generates (effectively) no warnings, is a complier that helps me write
buggier code. Why would I want that? Do I really care that the de{*filter*}
truncated some STL token name to 255 characters?!?

This is doubly frustrating because this bug existed in VC 5 (as is evidenced
by old MSDN technotes on the subject). Why didn't Microsoft fix this when
they were producing version 6? I've written compilers before; fixing the
broken #pragma function from above is not a difficult thing to do.

Am I the only one who is bothered by this?

Cliff



Sun, 22 Apr 2001 03:00:00 GMT  
 Warning C4786
        I am bothered by this too and #pragma disable doesn't help at
all. I thought SP1 for VC 6.0 would have addressed this issue, but
unfortunately, this is not the case. If you ever figure this out, please
post your findings to this newsgroup.
Thanks,
Vasi
Quote:
-----Original Message-----

Posted At: Wednesday, November 04, 1998 2:44 PM
Posted To: stl
Conversation: Warning C4786
Subject: Warning C4786

I know this is mentioned in a number of MSDN articles, but I none of
them
have proven satisfactory.

Does anyone know how to disable the Warning C4786 messages I get when
using
STL with VC 6. I've tried placing:

#pragma warning( disable : C4786)

in my code, but it doesn't do anything.

This is a HUGE problem for me. With some of our source files we are
getting
upwards of 550 warnings PER FILE! Not only does this slow the compile
process down immensely, but it also hides real and useful warning
messages
under a storm of useless and unimportant warnings. A compiler that
generates
too many warnings might as well generate none at all (since there's no
easy
way to remove the C4786 warnings from the list). And a compiler that
generates (effectively) no warnings, is a complier that helps me write
buggier code. Why would I want that? Do I really care that the de{*filter*}
truncated some STL token name to 255 characters?!?

This is doubly frustrating because this bug existed in VC 5 (as is
evidenced
by old MSDN technotes on the subject). Why didn't Microsoft fix this
when
they were producing version 6? I've written compilers before; fixing the
broken #pragma function from above is not a difficult thing to do.

Am I the only one who is bothered by this?

Cliff



Sun, 22 Apr 2001 03:00:00 GMT  
 Warning C4786

Quote:

>I know this is mentioned in a number of MSDN articles, but I none of them
>have proven satisfactory.

>Does anyone know how to disable the Warning C4786 messages I get when using
>STL with VC 6. I've tried placing:

>#pragma warning( disable : C4786)

>in my code, but it doesn't do anything.

>This is a HUGE problem for me. With some of our source files we are getting
>upwards of 550 warnings PER FILE!

I feel your pain. When I upgraded to VC6, I had one file that began to
generate 23 new C4786's, and I've yet to find a way to suppress them. I
shudder to think of 550! Are you placing the #pragma before the #includes?
If you are, make sure no one is re-enabling the warning; if it is being
re-enabled, you may have to disable it all over the place, because the
warning context of a template definition doesn't follow it to its point of
instantiation, which can be hard to determine. Also, to avoid the more
serious C4503, I had to use good ol' #define to shorten some type names, and
I had to redesign some class templates to use fewer template parameters, and
that may have helped C4786 as well. BTW, the documentation for C4503 claims
the maximum length of a mangled name is 247 characters. That's obviously
wrong. It's much larger than that, but it's still too little.

Quote:
>Not only does this slow the compile
>process down immensely, but it also hides real and useful warning messages
>under a storm of useless and unimportant warnings. A compiler that generates
>too many warnings might as well generate none at all (since there's no easy
>way to remove the C4786 warnings from the list). And a compiler that
>generates (effectively) no warnings, is a complier that helps me write
>buggier code. Why would I want that? Do I really care that the de{*filter*}
>truncated some STL token name to 255 characters?!?

I care, but since I can't do anything about it, I wish they would just get
rid of the warning altogether.

Quote:
>This is doubly frustrating because this bug existed in VC 5 (as is evidenced
>by old MSDN technotes on the subject). Why didn't Microsoft fix this when
>they were producing version 6? I've written compilers before; fixing the
>broken #pragma function from above is not a difficult thing to do.

>Am I the only one who is bothered by this?

No. All I can suggest is that you report this at:

  http://www.*-*-*.com/

--
Doug Harrison



Sun, 22 Apr 2001 03:00:00 GMT  
 Warning C4786
I have found that moving the #pragma warning (disable : 4786 ) to before you
#include the stl headers fixes the problem.

I had to find a fix for this as most of my source files failed to compile
(internal compiler error) due to the number
of these warnings

// STL.cpp : Defines the entry point for the console application.
//

#pragma warning ( disable : 4786 )  // Here for VC 6

#include <windows.h>
#include <vector>
#include <string>
using namespace std;

//#pragma warning ( disable : 4786 )  // Here for VC 5

int main(int argc, char* argv[])
{
 vector<string> vs;
 vs.push_back( "hello" );
 return 0;

Quote:
}

Peter




Mon, 23 Apr 2001 03:00:00 GMT  
 Warning C4786

Quote:

>I know this is mentioned in a number of MSDN articles, but I none of them
>have proven satisfactory.

>Does anyone know how to disable the Warning C4786 messages I get when using
>STL with VC 6. I've tried placing:

>#pragma warning( disable : C4786)

>in my code, but it doesn't do anything.

The correct syntax is:
#pragma warning( disable : 4786)

Then it will do quite a lot, even if it's not perfect.

Chris{*filter*}son



Mon, 23 Apr 2001 03:00:00 GMT  
 Warning C4786
When the classes generating these warnings are included in your precompiled
headers, it often doesn't matter where you put your #pragma warning
(disable:4786) statement or how many times you do it.  You do a build from
scratch and most of the warnings are suppressed.  Then you change something
and do a rebuild and the compiler seems to forget about your disabling the
warning...

There is another workaround for this problem.  Try taking the names of some
of you classes (especially the ones you use in collections like lists,
vectors and maps) and #define their real names to shorter names.

For example, say you have a class that you want to use in a map:

   class CMyReallyReallyLongNamedClass
   {
      (blah blah blah)
   }

   typedef std::map<int, CMyReallyReallyLongNamedClass> CMyMap

This is absolutely going to generate 4786s all over the place when you try
to use CMyMap.  To get around this, you could put the following directive
just before the class definition above

   #define CMyReallyReallyLongNamedClass _MRRLNC

Now any instance of CMyReallyReallyLongNamedClass will show up as _MRRLNC in
all debugging windows and you will be much closer to making the 255
character limit -- try even shorter names if you need to.

Not perfect, but it does work

To figure out which class' names you need to shorten, just look at all the
4786 warnings.  Wherever you see an instance of you class' name appearing
multiple times, that's a good candidate

Joe O'

Quote:

>I know this is mentioned in a number of MSDN articles, but I none of them
>have proven satisfactory.

>Does anyone know how to disable the Warning C4786 messages I get when using
>STL with VC 6. I've tried placing:

>#pragma warning( disable : C4786)

>in my code, but it doesn't do anything.

>This is a HUGE problem for me. With some of our source files we are getting
>upwards of 550 warnings PER FILE! Not only does this slow the compile
>process down immensely, but it also hides real and useful warning messages
>under a storm of useless and unimportant warnings. A compiler that
generates
>too many warnings might as well generate none at all (since there's no easy
>way to remove the C4786 warnings from the list). And a compiler that
>generates (effectively) no warnings, is a complier that helps me write
>buggier code. Why would I want that? Do I really care that the de{*filter*}
>truncated some STL token name to 255 characters?!?

>This is doubly frustrating because this bug existed in VC 5 (as is
evidenced
>by old MSDN technotes on the subject). Why didn't Microsoft fix this when
>they were producing version 6? I've written compilers before; fixing the
>broken #pragma function from above is not a difficult thing to do.

>Am I the only one who is bothered by this?

>Cliff



Mon, 23 Apr 2001 03:00:00 GMT  
 Warning C4786
Although pragma can suppress warnings, it doesn't solve them.

C4503 may be serious if the problem is not solved. I may have a solution
here, please feel free to write in if it doesn't work or there are problems
with it.

Remember that C++ is an OO language? Perhaps inheritance can solve the
problem when used in place of typedef.

class LengthMatters
: std::public vector<string>
{

Quote:
};

instead of

typedef std::vector<string> LengthMatters;

JDarwin



Tue, 24 Apr 2001 03:00:00 GMT  
 Warning C4786

Quote:

> When the classes generating these warnings are included in your
> precompiled
> headers, it often doesn't matter where you put your #pragma warning
> (disable:4786) statement or how many times you do it.

Simply put the #pragma at the top of your PCH header file.  That will
disable the warning always.

-=Mark=-

Mark Atkinson
Technical Director
Computer Artworks Ltd.
London, UK.
http://www.artworks.co.uk



Tue, 24 Apr 2001 03:00:00 GMT  
 Warning C4786

Quote:

>Simply put the #pragma at the top of your PCH header file.  That will
>disable the warning always.

Not always.

--
Doug Harrison



Tue, 24 Apr 2001 03:00:00 GMT  
 Warning C4786

Quote:


> >Simply put the #pragma at the top of your PCH header file.  That will
> >disable the warning always.

> Not always.

It's always worked fine here.  Those warnings were a real pain when we
first upgraded to VC6, but they haven't been seen since.

I'm assuming no-one is using the "automatic" PCH mechanism, however.

-=Mark=-

Mark Atkinson
Technical Director
Computer Artworks Ltd.
London, UK.
http://www.artworks.co.uk



Fri, 27 Apr 2001 03:00:00 GMT  
 Warning C4786
I do not use the "automatic" precompiled header settings.  I manually
specify stdafx.h.  And even if I put the #pragma as the very first thing in
stdafx.h, it doesn't always work.  Yes, when I do a complete rebuild it
always works, but when the then start making changes and rebuild again (with
incremental compilation and minimal rebuild turned on) the warnings almost
always reappear.

Turning off incremental compilation and minimal rebuild is not an option.

Joe O'

Quote:




>> >Simply put the #pragma at the top of your PCH header file.  That will
>> >disable the warning always.

>> Not always.

>It's always worked fine here.  Those warnings were a real pain when we
>first upgraded to VC6, but they haven't been seen since.

>I'm assuming no-one is using the "automatic" PCH mechanism, however.

>-=Mark=-

>Mark Atkinson
>Technical Director
>Computer Artworks Ltd.
>London, UK.
>http://www.artworks.co.uk



Fri, 27 Apr 2001 03:00:00 GMT  
 Warning C4786
I did this and it worked for me. Make an stl.h file like the one below and
use it where needed

//////////////////////////////////////////////////////////////////////
// stl.h: common standard template library stuff
//
//////////////////////////////////////////////////////////////////////

#if !defined(_STL_H)
#define _STL_H

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

// use these STL classes
#pragma warning(disable:4786)
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <stack>
#include <string>
#include <functional>
#include <set>
// ADD MORE INCLUDES HERE IF NEEDED
using namespace std;

#endif // !defined(_STL_H)



Sat, 05 May 2001 03:00:00 GMT  
 Warning C4786
In the ever elusive {*filter*}space on Wed, 4 Nov 1998 11:43:33 -0800 a
strange ordering of electrons

short time as:

Quote:
>I know this is mentioned in a number of MSDN articles, but I none of them
>have proven satisfactory.

>Does anyone know how to disable the Warning C4786 messages I get when using
>STL with VC 6. I've tried placing:

>#pragma warning( disable : C4786)

>in my code, but it doesn't do anything.

in mine it didn't, till i{*filter*}ed around with the precompiled headers
and made sure that the #pragma statement was in them (if i had stl in
the precompiled headers)
[remove nospam_ from the email address before replying]
Was immer auch geschieht, so tief duerft Ihr nicht sinken,
dass den Kakao, durch den man Euch zieht, Ihr am Ende muesst trinken.
<Erich Kaestner>


Tue, 08 May 2001 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. warning C4786: STL template warnings

2. Real Work Around for Compiler Warning C4786 ?

3. Workaround for Compiler Warning C4786?

4. Warning C4786

5. warning C4786

6. Warning C4786 --- URGENT ---Please have a look

7. warning C4786 when compiling debug version of Stroustrup's calculator

8. Warning C4786

9. Q: VC6, still warning C4786 ?

10. warning C4786

11. warning C4786 when compiling debug version of Stroustrup's calculator

12. Compiler Warning C4786

 

 
Powered by phpBB® Forum Software