I've two pieces of code:
A do while loop:
do
{
errorflag=0;
...
if(cond1)
{
errorFlag=12;
break; // Error Conditions
}
.
. // Processing
.
if(cond2)
{
errorflag=56;
break;
}
.
.
} while (0);
A goto label:
errorflag=0;
if(cond1)
{
errorflag=12;
goto xy;
.
.
.
.
if(Cond2)
{
errorflag=56;
goto xy;
}
.
.
.
xy:
Which one is better? Please give me the details why? or is there any better way to do this? We are optimizing the code. We are most looking into these kind of big loops. Is assembly level, there is not that much scope for optimisation. Please provide your inputs.
I dont like to use else-if since, it is again a overhead of checking one more condition. So directly exit when there is an issue.
I feel after this edit my question makes sense
Thanks in advance