CString中的异常---特别紧急,紧急,救我一把
程序连续运转三天过后,在debug版本下出现如下提示:
Debug Assertion Failed
Progtam:c:\pepoleorientation\pd.exe
File:e:\Program files\microsoft viusal studio.net 2003\vc7\atlmfc\include\atlsimpstr.h
Line:778
Expression:pOldData->nAllocLength<nLength
For information on how you program can cause an assertion
failue,see the visual c++ documentation on asserts
(Press Retry to debug the application)
终止 重试 忽略
--------------------------------------------
我看了提示文件的源码
ATL_NOINLINE void Reallocate( int nLength )
{
CStringData* pOldData = GetData();
ATLASSERT( pOldData->nAllocLength < nLength );////这里是778行
IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
CStringData* pNewData = pStringMgr->Reallocate( pOldData, nLength, sizeof( XCHAR ) );
if( pNewData == NULL )
{
ThrowMemoryException();
}
Attach( pNewData );
}
---------------------------------------
ATLASSERT( pOldData->nAllocLength < nLength );////这里是778行
请问大家可能造成这个错误的常见操作是那些?举个示例.推荐个标准写法.