Fallthough is when a switch case "falls through" to another case:
switch(someInt) {
case 0:
// Do stuff
case 1:
// Do more stuff
break;
}
In this example, if someInt
is 0, it will execute both commented sections of code before hitting the break
statement, which exits the switch. Forgetting to put in a break
after each switch section is a common beginner error. If you want to make case 0
only execute it's own code and not the code for case 1
, it would look like this:
switch(someInt) {
case 0:
// Do stuff
break;
case 1:
// Do more stuff
break;
}
Compiling with optimization simply refers to using the optimization option to let the compiler figure out ways to speed up or simplify the program.