Compilers
Which describes a cross compiler?
- AA compiler that blends two programming languages into a single new language
- BA compiler producing code for a different CPU than its host
- CA tool that compares the output of several compilers and picks the fastest
Show answer and explanation
Answer: B. A compiler producing code for a different CPU than its host
A cross compiler runs on, say, an x86 PC while generating machine code for an Arm or RISC-V microcontroller. It is essential when the target device, such as an embedded system, lacks the performance or memory to run a compiler itself. The generated code is checked by flashing it to the target or running it in an emulator of that device. It neither blends languages nor compares compilers.
- A. It does not blend languages.
- B. Correct. It generates code for a different kind of CPU.
- C. It is not a tool for comparing results.