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
Post Reply
User avatar
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 » Sat Oct 06, 2012 7:56 pm

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.

User avatar
Acid_Snake
Retired Mod
Posts: 3099
Joined: Tue May 01, 2012 11:32 am
Location: Behind you!

Re: How is C not tied to specifc processor?

Post by Acid_Snake » Sat Oct 06, 2012 11:57 pm

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 » Sun Oct 07, 2012 12:13 am

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 » Wed Jan 02, 2013 4:59 pm

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

User avatar
hgoel0974
Retired Mod
Posts: 2154
Joined: Mon Jul 23, 2012 11:42 pm
Location: Maia, Pleiades Nebula

Re: How is C not tied to specifc processor?

Post by hgoel0974 » Wed Jan 02, 2013 5:03 pm

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"

User avatar
noname120
Developer
Posts: 775
Joined: Thu Oct 07, 2010 4:29 pm

Re: How is C not tied to specifc processor?

Post by noname120 » Sun Jan 06, 2013 5:53 pm

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

Post Reply

Return to “Programming”