VC7(VS2002)调试时 std::string 超过15字符乱码问题

VC8(VS2005)无此问题。



std::string str = "1234567890123456";        
const char* p    = str.c_str();
调试时:str的值是乱码,p是正确值。

可能是VS2002的bug,根源可能是:
std::string 不超过15字符保存在_Bx.Buf中,否则保证在_Bx.Ptr中。
调试时VC7总是读取的_Bx.Buf。
posted on 2023-03-16 15:56  闻缺陷则喜何志丹  阅读(17)  评论(0编辑  收藏  举报  来源