All return statements will return to wherever the function was called from, regardless of where they are located within the function.
For instance, if I wrote:
int main()
{
_iT3Interrupt();
}
Then the return statement in _iT3Interrupt
will revert control flow back to main
.
Also, any loop can be exited (even if the condition is 1
, true
, or some equivalent) with any of the following constructs:
break; //exits the loop
return; //exits the function, thus ending the loop
goto <label-outside-loop>; //self-explanatory
exit(); abort(); //exits the program. Bit of a stretch to say that this ends the loop...
And in C++, throw
, which will unwind the stack until it reaches a corresponding catch, thus exiting the function. The C setjmp
and longjmp
functions may also be applicable here, but I don't know enough C to be certain of their usage.