Hi,
I'm using the uVision Realview compiler and am confused about the 'break' statement inside the 'while' loop inside the 'case' statement : does it exit the while loop and executes the 'extra code' or does it exit also the 'case' statement completely without executing the 'extra code'?
use next (abstract) code:
switch ( x ) { case y: while(1){ break; } 'extra code' break; }
Thanks
Henk
The break is owned by the closest surrounding statement that supports break - in this case the while, so it doesn't affect the behaviour of the switch statement.
Note the funny thing with continue, which is only supported by loops, but not by a switch statement:
for (;;) { switch (xx) { case 0: break; // exits switch statement, continues last statements in loop. case 1: continue; // all the way to restart the for loop. } // more statements to process before next iteration of loop if (y) { break; // exit loop } }