I was just wondering what happens inside of an \"if OR\" and \"if AND\". I have a feeling that it\'s just syntactic sugar to use &
For those who read C# better than assembly, the real internal forms are closer to:
if(a) goto yes;
if(b) goto yes;
if(c) goto yes;
goto no;
yes: DoSomething();
goto done;
no: /* if there were an else it would go here */;
done: ;
for
if(a || b || c)
DoSomething();
and
if(!a) goto no;
if(!b) goto no;
if(!c) goto no;
yes: DoSomething();
goto done;
no: /* if there were an else it would go here */;
done: ;
for
if(a && b && c)
DoSomething();
That's because the actual instructions are conditional branches -- in the internal form it is not possible for an if
to be associated with a block, a nested if
, or actually anything except a goto
.