
上QQ阅读APP看书,第一时间看更新
Optimization
Generating intermediate code helps the compiler to make optimizations in the code. Compilers try to optimize code a lot. Optimizations are done in more than one pass. For example, take the following code:
int a = 41;
int b = a + 1;
This will be optimized into this during compilation:
int a = 41;
int b = 41 + 1;
This again will be optimized into the following:
int a = 41;
int b = 42;
Some programmers have no doubt that, nowadays, compilers code better than programmers.