R6010 abort() has been called 错误

来源:互联网 发布:阿克伦大学 知乎 编辑:程序博客网 时间:2024/06/04 18:14

错误  但很奇怪 。 看代码。
STATE FindEx(const char* pszPat)const
{
 STATE state = 0;
 unsigned int i = 0;
 while ( i < m_AC[state].m_NextState.size())
 {
  STATE temp = m_AC[state].m_NextState.at(i);
  char * str = (char*) m_AC[temp].m_Str.c_str();

  if (0 == strncmp(pszPat, str, m_AC[temp].m_Len) )
  {
   i = 0;
   state = temp;
   continue;
  }
  i++;
 }
 return state;
}  这样程序没有问题 

当我把 i++ 的位置 改了之后
STATE FindEx(const char* pszPat)const
{
 STATE state = 0;
 unsigned int i = 0;
 while ( i < m_AC[state].m_NextState.size())
 {
   i++;
  STATE temp = m_AC[state].m_NextState.at(i);
  char * str = (char*) m_AC[temp].m_Str.c_str();

  if (0 == strncmp(pszPat, str, m_AC[temp].m_Len) )
  {
   i = 0;
   state = temp;
   //continue;
  }
  
 }
 return state;
}

程序就出现这个问题了

原创粉丝点击