dvplayltd
asked on
Why return do not terminate function in MS C2008 ++ ?
Hi experts!
I'm new to MS C++ 2008 and need little help. I read in manual that return should break current execituon of the function, but after I finish my project by accident I find that look that is not true. Look my code:
long CCPlayCtrl::SetToZeroRemai nTimeCurrF ile(long lCard)
{
// ... code
if (!bFind)
return -98; //Here should exit from function?!? Why do not exit and contunie with next code???
// next code write a message to the text file. I was shocked to find that bFind=false, return -98 is executed and function execution just contunie with next row of code. WHY ???
if (mbWriteAllCmd[lCard])
{
sLog.Format( _T( "CCPlayCtrl::SetToZeroRema inTimeCurr File-->bFi nd=false !!!\n" ));
StradisLogFunction(sLog);
}
lStradisDecoderSettingsFra me[iIndex] =0; lStradisDecoderSettingshWn g[iIndex]= 0;
return 0;
}
Do i need to change all situations like this in my code, or this is some specific case? In any case I should know what is going on. To be more clear, this is ActiveX project (OCX) and this is one of his public functions.
I'm new to MS C++ 2008 and need little help. I read in manual that return should break current execituon of the function, but after I finish my project by accident I find that look that is not true. Look my code:
long CCPlayCtrl::SetToZeroRemai
{
// ... code
if (!bFind)
return -98; //Here should exit from function?!? Why do not exit and contunie with next code???
// next code write a message to the text file. I was shocked to find that bFind=false, return -98 is executed and function execution just contunie with next row of code. WHY ???
if (mbWriteAllCmd[lCard])
{
sLog.Format( _T( "CCPlayCtrl::SetToZeroRema
StradisLogFunction(sLog);
}
lStradisDecoderSettingsFra
return 0;
}
Do i need to change all situations like this in my code, or this is some specific case? In any case I should know what is going on. To be more clear, this is ActiveX project (OCX) and this is one of his public functions.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER