Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What is Code/binary portability ?(computer science)

  1. Dec 24, 2008 #1
    Hi,
    This is Gokul. Can anyone explain me what is Code/binary portability..?
     
  2. jcsd
  3. Dec 31, 2008 #2
    Imagine a program that starts:

    #include <linux.h>
    .....

    It's obvious that it is not portable. You can't just compile the code on a different system (Windows, Mac, ...)

    This is code portability. Most of the times its "solved" using conditional compiling like this:

    #ifdef WIN32
    #include <windows.h>
    #elseif
    #include <linux.h>
    #endif

    This works because most of the compilers define the variable saying for which platform it is running.

    The real solution is using functions that are standard and all platforms support.

    Binary portability is another problem. After compiling a program to machine code, that code will run only on that specific platform. Examples:

    x86, the standard intel & amd 32 bits processors
    em64t, the new intel & amd 64 bits
    powerpc, the old processor type used on Mac's
    alpha, sparc, arm, itanium are other types

    You can have for instance Linux on x86 or Linux on em64t. If you compile code for em64t it won't run on the x86 platform; you need to recompile it.

    To avoid this, some languages like Java and .NET use bytecode, an independent binary form that gets translated to machine code at runtime using a virtual machine.
     
  4. Jan 1, 2009 #3
    Hi..thank u very much
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: What is Code/binary portability ?(computer science)
  1. Computer coding (Replies: 8)

Loading...