VC6.0的“++”、“--”运算符有问题,是否和双核CPU系统有关?

来源:百度知道 编辑:UC知道 时间:2024/06/01 04:19:32
我的一工程中有如下函数:
bool CALLBACK ApplicationOnChar( void )
{
unsigned short usCharInfo = FRAME.GetCharInfo();//取得系统输入的字符信息
//加入到获得焦点的字串中,piFocusEditPoint变量跟踪编辑点
if( NULL != pstrFocus && NULL != piFocusEditPoint )
{

//*piFocusEditPoint ++; //当我用++运算符是,忽而在字符串前端插入,忽而在字串后端追加,正确的是应该都在后端追加才对
*piFocusEditPoint += 1;//当我改成这句是,就正确了
pstrFocus->Insert( *piFocusEditPoint, ( TCHAR )harInfo );

return true;
}
我的CPU是AMD Athlon(tm)64X2 Dual4400+, 系统是XP Service Pack2
哪大侠遇到过同样情况,该如何解决请赐教,不胜感激!

把*piFocusEditPoint ++; 改成(*piFocusEditPoint)++; 这样就应该没问题了,呵呵

靠 这和cpu一点关系没有的 搞清楚++i和i++是不一样的

*piFocusEditPoint ++; 和*(piFocusEditPoint ++)是等效的。
运算符的优先级问题把。应该改成(*piFocusEditPoint)++

你又没有写汇编指令,所以这跟你的CPU没有关系 ,自己调试跟踪一下就可以找到原因了