I have two codes:
A while while:
do
{
errorflag=0;
...
if(cond1)
{
errorFlag=12;
break;
}
.
.
.
if(cond2)
{
errorflag=56;
break;
}
.
.
} while (0);
Goto attribute:
errorflag=0;
if(cond1)
{
errorflag=12;
goto xy;
.
.
.
.
if(Cond2)
{
errorflag=56;
goto xy;
}
.
.
.
xy:
Which one is better? Please give me information why? or is there a better way to do this? We are optimizing the code. We look most at such large loops. It is a build level; there are not many possibilities for optimization. Please enter your details.
I do not like to use else-if, since this is again the overhead of checking another condition. So go out immediately when there is a problem.
I feel that after this change my question makes sense
Thanks in advance
Pappu source
share