How does C become machine independent ?

This is a discussion on How does C become machine independent ? within the C Programming forums, part of the General Programming Boards category; C is very near to Asm and C code is first translated into asm before compiling and linking. So asm ...

  1. #1
    somepsomewhere
    Guest

    Exclamation How does C become machine independent ?

    C is very near to Asm and C code is first translated into asm before compiling and linking. So asm is involved.But many times asm is found to machine dependent(i.e it works on some machines and errs on others even from the same family of PCs like IBM family and x86 processors(x>=3)).How does then C become machine independent ?

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    65
    Machine independence of C is that you compile the same source code in different machines and get different assembler code specific to that type of machine.
    So your source code is the same. (Actually for very long programs, especially in low level ones, you may write code specific to the architecture, so it no longer becomes portable). Even in different compilers your code will behave differently if you use non-standard features.
    Because of that I never consider C much portable. Java is simply much much much more machine independent than C.
    The experimenter who does not know what he is looking for will not understand what he finds.
    - Claude Bernard

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Machine Learning with Lego Mindstorms
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-30-2009, 01:34 PM
  2. Finite State Machine
    By ArlexBee-871RBO in forum C++ Programming
    Replies: 8
    Last Post: 07-14-2008, 11:59 AM
  3. Replies: 4
    Last Post: 01-18-2008, 06:05 PM
  4. Porting from 32 bit machine to 64 bit machine!
    By anoopks in forum C Programming
    Replies: 10
    Last Post: 02-25-2005, 07:02 PM
  5. Creating a Virtual Machine
    By Chronom1 in forum C++ Programming
    Replies: 7
    Last Post: 10-05-2003, 11:11 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21