We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Why are there several optimization levels as on would always want to optimize the code to maximum?
Precisely because there is no single definition of "maximum!" It could mean smallest code size, or fastest code execution - usually there is a tradeoff between the two; eg, Inline functions produce faster execution, but require more code space! There may be particular reasons why certain optimisations are inappropriate in a certain application; eg consider the use of 'volatile'. If you look at any Compiler manual, you will see that they all offer a range of Optimisation options - so that you can choose what is actually "optimum" in your particular application. Some programmers, familiar with other compilers, would say, "wot? only eight different levels!"