Reputation: 794
I got the following question in which the correct answer is B. I don't understand why A is not correct, because the compiler is doing optimization on the code and I didn't find any information about a preproccessor that is doing that.
Upvotes: 1
Views: 2034
Reputation: 1
A compiler takes source code written in a programming language and converts it into machine code that can be run on a computer. A preprocessor is a program that processes a source code file before it is passed to the compiler.
Upvotes: 0
Reputation: 2129
Because the right answer is B ;)
A compiler doesn't have to make code improvement to produce correct machine code. it's main task is to produce machine code from source code by performing syntactic and semantic analysis on source code and the if the code is OK produce machine code.
A compiler can produce correct machine code without optimization
In gcc for example you can choose optimization level with option -O
Upvotes: 1