Advertising (This ad goes away for registered users. You can Login or Register)

How is C not tied to specifc processor?

Programming on your favorite platform, for your favorite platform? Post here
Locked
SHA-1
Posts: 26
Joined: Sat Jun 09, 2012 9:20 am
Location: In my house...

How is C not tied to specifc processor?

Post by SHA-1 »

This has bugging me for a while, now.

Why is C not tied to a specific processor, I just can't get my head around it. Maybe someone can shed some light on this.

I know assembly is tied to a certain processor so why not C?
Advertising
Languages, I know:
C++, C, Perl, Bash.

Languages I'm learning:
Assembly, Python, Java.
Acid_Snake
Retired Mod
Posts: 3100
Joined: Tue May 01, 2012 11:32 am
Location: Behind you!

Re: How is C not tied to specifc processor?

Post by Acid_Snake »

C is general purpose, and sometimes it is tied to a specific platform
Advertising
Downsider
Posts: 5
Joined: Thu Apr 19, 2012 4:51 am

Re: How is C not tied to specifc processor?

Post by Downsider »

Compiled C isn't C. Before you compile C, it's not tied to a specific processor, but after you compile it, it becomes specific to the platform you're targetting.
ks177
Posts: 4
Joined: Thu Oct 18, 2012 5:29 pm

Re: How is C not tied to specifc processor?

Post by ks177 »

C is translated by the compiler into instructions a specific processor can understand.

Incidentally, you can also use assembly language in a somewhat more portable manner by using intrinsic functions instead of inline assembly.

http://msdn.microsoft.com/en-us/library ... 80%29.aspx
hgoel0974
Retired Mod
Posts: 2155
Joined: Mon Jul 23, 2012 11:42 pm
Location: New York

Re: How is C not tied to specifc processor?

Post by hgoel0974 »

No language is tied to a specific processor, it is the assembly, when you compile code, you translate it into assembly, before compiling, you get to choose which platform you want to compile it for, and the compiler will translate it into that platforms assembly, that is why no language is tied to a processor before compiling
"If the truth is a cruel mistress, then a lie must be a nice girl"
noname120
Developer
Posts: 777
Joined: Thu Oct 07, 2010 4:29 pm

Re: How is C not tied to specifc processor?

Post by noname120 »

A compiler needs to be ported to a platform to be able to use C on it.
This is why any compiled language is not tied to a specific processor.
Funny stuff
<yifanlu> I enjoy being loud and obnoxious
<yifanlu> rooting an android is like getting a hooker pregnant
<xerpi> I sometimes think I should leave all this stressing **** and be a farmer instead
Locked

Return to “Programming”