What is Code/binary portability ?(computer science)

  • Thread starter Thread starter goksvr
  • Start date Start date
  • Tags Tags
    Science
AI Thread Summary
Code and binary portability are crucial concepts in software development. Code portability refers to the ability of a program to run on different operating systems without modification. This is often addressed through conditional compiling, where the code includes specific headers based on the platform being used. The ideal solution is to utilize standard functions that are universally supported across platforms.Binary portability, on the other hand, concerns the compatibility of compiled machine code across different hardware architectures. For instance, code compiled for x86 architecture will not run on em64t or other processor types without recompilation. To mitigate these issues, languages like Java and .NET employ bytecode, which is platform-independent and executed by a virtual machine, allowing for greater flexibility across different systems.
goksvr
Messages
5
Reaction score
0
Hi,
This is Gokul. Can anyone explain me what is Code/binary portability..?
 
Technology news on Phys.org
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.
 
Hi..thank u very much
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top