std::string is a class that has its own representation for the underlying string somewhere, but you debugger doesn't necessarily know about it. So, no you should not worrry about this "garbage".
Unfortunately, this makes debugging a bit harder, but it's rather a question of the debugger, not std::string. Also, different environments deal differently with this. For example in my VC6 STLPort configuration, it's quite ugly (and a hack is to watch s._M_start), but in VC.NET 2002 std::strings show up correctly under the debugger. So your mileage may vary.
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
to my autoexp.dat for the Dinkumware's upgraded STL for MSVC++ 6.0. It works well for me. Sometimes the data is in the _Ptr variable, other times in the _Buf. It can be a hassle expanding it always in the watch or variables windows.
Originally posted by Mick
What garbage??? show an example in code, the expansion is controlled by the autoexp.dat in your <install dir>\common\msdev98\bin
Now there is something I didn't know. Thanks, that will come in handy
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
std::basic_string<*> =Ptr=<_Bx._Ptr,s> Buf=<_Bx._Buf,s>
It doesn't work for me
I have no idea what stl am I using, how can I know that
anyway I have added this at the end of the file and still I see ??? when the data is in the _ptr and not in the _Buf
What compiler/platform do you have? Maybe somebody with the same implementation can give you their version. Also, you said that it doesn't work when it is in _ptr, mine uses _Ptr, make sure the case matches in your autoexp.dat and in the watch window. Does it work when the string is in _Buf?
If you wanted to just figure out what to put, expand a string variable in the watch window when you are debugging. When I expand mine, I have to expand the string first, and then expand the _Bx member. The string is then either in _Ptr or _Buf. If you just find the location of the string when it's not working for you, that would help in creating the right line in the autoexp.dat.
Bookmarks