General discussion

Locked

'C' compiler and machine language

By samjkd ·
it is said that 'c' is a machine independent language.but Processors understands only machine level language 0 and 1. different processor have different machine level language. if so will the complier of 'c' will be different for different processor i,e when the 'c' program runs on a pentium machine the 'c' compiler changes (compiles) the 'c' code to the pentium machine code if the same 'c' program is made to run on athlon processor the compiler converts it to the athlon machine code.

1.Does 'c' language has different compiler for different machines?

2.If not then how a single compiler can convert to differnt machine codes?


mail me to samjkd@yahoo.com

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Jaqui In reply to 'C' compiler and machine ...

the cpu architecture is known by the compiler, and it can optimise the compiled program for that architecture, or cross compile for a different architecture if you want.

Collapse -

by gvr.deepak In reply to 'C' compiler and machine ...

Hi
As per my knowledge after writing the c code we use the compiler to get the object code right (.obj) then that file is executed by the to get the output. I mean to say that what ever may be the processor we use the compiler to get the object code but not to execute. This object code is created irrespective of the processor being used.

Related Discussions

Related Forums