How can I work around Visual C++ 2005's "decorated name length exceeded, name was truncated" warning?

Casey Patton picture Casey Patton · Jul 30, 2011 · Viewed 9.3k times · Source

For example, say for some reason I had a piece of code that looked like this:

mutable std::vector<std::vector<std::vector<std::vector<
std::vector<MyNamespace::MyType> > > > > myFreakingLongVectorThing;

and I am getting a warning that looks like this:

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\xstring(1665) : warning   
    C4503: 'std::vector<_Ty>::operator []' : decorated name length exceeded, name was truncated
    with
    [
      _Ty=std::vector<std::vector<std::vector<std::vector<std::vector<MyNamespace::MyType>>>>>
    ]

is there any way I could rewrite that freaking long vector thing to not get that warning? I still want the data structure to be the same, but not get that warning. I don't want to disable the warning. Possible?

Note: This is Visual Studio 2005

....if you're really curious about why I'm working with such a hideous data structure, it's caused by auto-generated code.

Answer

Bo Persson picture Bo Persson · Jul 30, 2011

If you don't want to see the warning you either have to disable it or use a newer compiler.

The warning is about debug information being limited to 255 characters for the type name. As long as these 255 characters are not identical for two different types, you are ok. And if they are identical, you cannot do much about it anyway!

Just turn it off until you can upgrade the compiler!