World's most popular travel blog for travel bloggers.

Why do compilers produce assembly code?

, , No Comments
Problem Detail: 

Assembly language is converted in to machine language by assembler. Why would a compiler convert high-level language to assembly? Can't it directly convert from the high-level language to machine code?

Asked By : CODERSAM

Answered By : Martin Berger

Other reason for compilers to produce assembly rather than proper machine code are:

  • The symbolic addresses used by assemblers instead of hard-coding machine addresses make code relocation much easier.
  • Linking code may involve safety checks such as type-checking, and that's easier to do with symbolic names.
  • Small changes in machine code are easier to accomodate by changing the assembler rather than the code generator.
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/14749

0 comments:

Post a Comment

Let us know your responses and feedback