Discussion Locked

'C' compiler and machine language

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

2 replies

by jaqui

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.

by gvr.deepak

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.

This discussion is closed to new replies.