answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Why is compiled code not portable from one platform to another?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between platform independent and portable in programming?

There is no difference. They mean exactly the same thing. Portable code is independent of the platform while non-portable code is platform-dependant.


When is a computer language called machine dependent?

When the code is targeted towards a specific machine architecture. Machine code is entirely machine-dependent, as is the low-level assembly language used to produce that machine code. High-level languages are not machine dependant, however source code can still be targeted towards a specific architecture or platform. Such code is non-portable, however many high-level languages provide methods to filter machine-dependant or platform-dependant code such that the same source code can be compiled on different machines and platforms.


What is compiled code?

Compiled code is plain-text source code that is translated from an English-like, high-level language into either machine code or byte code by a program known as a compiler. Machine code is the native language of the machine, consisting of binary patterns that represent a sequence of machine instructions and their operands. Byte code is the native language of a virtual machine; a machine that only exists within a computer's memory. The virtual machine is simply a program that interprets the byte code in order to produce the actual machine code. Unlike machine code which must be compiled separately for each platform, byte code will run on any platform that has a corresponding virtual machine implementation.


Why c is machine independent language?

C source code is portable; it can be compiled upon any machine with a suitable C compiler in order to produce the machine-dependant code (the machine code). However, C can also be used to write machine-dependant code, or code that is dependant upon specific platforms. In order to be completely portable, the code must use the C standard library and/or generic libraries.


Is a code written in Eiffel programming language compiled or interpreted?

Compiled.

Related questions

What is the programming language for apple apps?

Usually C++ or Java. Java is mostly used in mobile devices because of its highly portable (cross-platform) nature. C++ code is faster and is just as portable as Java but must be compiled separately for each platform. Java apps need only be compiled once for all platforms.


What is meant by bytecode?

byte code is an intermediate language,it is compiled code of java source program, it is virtual machine code,it is a platform independent code which doesn't have any instructions from os,and it is a portable code,and it is a collection of mnemonics.


What is the difference between platform independent and portable in programming?

There is no difference. They mean exactly the same thing. Portable code is independent of the platform while non-portable code is platform-dependant.


Why java is secure portable and platform independent language?

Java is platform independent because code is compiled into an intermediate language, called "byte code", which is then compiled into native machine code on the system that runs the byte code. In this way, any system that supports Java can run any Java application (well, almost, there are ways to break this mechanism with the "native" keyword). "Portable" is just another term for "platform independent". Finally, Java is claimed to be secure because it runs inside a protected environment, called the JavaVM (Virtual Machine) that stops a program from doing things that the SecurityManager has been told should not be allowed (such as modifying or deleting some files, etc). Recent exploits have proven that Java may not be as secure as previously claimed by Oracle.


What platforms are free?

There is no such thing as a platform-free programming language. The correct term is platform-independent language. It simply means that the same source code can be compiled or interpreted upon any platform; the code is not machine-dependent.


Is c plus plus platform dependent or platform independent?

The language itself is platform independent. However, specific implementations may be platform dependant. For instance, code written with Microsoft Visual C++ is generally intended to be compiled upon Windows platforms only, not Linux or Mac platforms. Although pre-compiler directives can filter machine specific code to suit the current platform, programmers need to be careful to avoid implementation-specifics when porting code to other compilers. If code is intended to be portable, it's better to use an implementation that conforms to the ISO standard, and that has implementations for all the intended platforms to accommodate platform-specific code.


Why are translators used to translate the computer programming languages?

They are not translators, they are either compilers or interpreters. High-level source code cannot be executed in its native form, it must be converted to machine code, the native language of the computer. Compiled languages compile the entire source code into a standalone machine code executable. Once compiled, the executable can be transferred to other computers. Interpreted languages require additional software, an interpreter, to execute. So long as a machine has the required interpreter, the source code can be executed. This is achieved by converting statements to machine code one statement at a time. C++ is an example of a compiled language and is used to produce much of the software running on computers today. Some versions of BASIC, such as QBASIC, are interpreted. Source code is not compiled, it is interpreted by the QBASIC interpreter which is built into the code-editor. Java is an example of a language that is both compiled and interpreted. Rather than compiling to machine code it compiles to byte code which can then be executed by the Java Virtual Machine. Java programs are highly portable as they need only be compiled once and can be executed on any device that has a JVM. By comparison, C++ programs must be compiled separately for each platform. That is, a Microsoft Windows executable will not run on an Apple Mac -- the source code must be compiled separately for each. Such code must be crafted to cater for each platform, with filters to exclude or include platform-specific code as appropriate for the current compilation.


Is c plus plus platform independent?

Yes. Code must still be written specifically to suit each platform, however C++ itself is not platform dependant. To port code between platforms, the source code needs to employ compiler directives (#ifdef/#ifndef) to filter the required code to suit the current platform, and the code must be compiled separately upon each platform. By contrast, Java need only be compiled once on any platform, and the resultant byte code can then be interpreted and executed upon any machine that supports a Java Virtual Machine implementation. This makes it much easier to produce cross platform applications, but performance will suffer as a result of the interpretation.


Which software runs a specific program?

It depends on which specific program you have in mind. Native machine code programs do not require any software to run; the program was converted into the machine's native language during compilation and does not require further translation. However, machine code is non-portable. To execute the same program on another platform the source code must be recompiled for that platform. Conditional compilation directives ensure that the correct machine-specific source code is compiled. Byte code programs, however, do require software to execute. Byte code is not native machine code so must be converted to native machine code while it is executing. This is achieved using a runtime program known as an interpreter. Java is a typical example. Java source code is compiled to Java byte code suitable for interpretation by the Java virtual machine (JVM). Thus a JVM is required to execute Java programs. Unlike native machine code, byte code is portable; the same byte code will execute upon any machine that has a suitable interpreter available.


Which software runs specific program.?

It depends on which specific program you have in mind. Native machine code programs do not require any software to run; the program was converted into the machine's native language during compilation and does not require further translation. However, machine code is non-portable. To execute the same program on another platform the source code must be recompiled for that platform. Conditional compilation directives ensure that the correct machine-specific source code is compiled. Byte code programs, however, do require software to execute. Byte code is not native machine code so must be converted to native machine code while it is executing. This is achieved using a runtime program known as an interpreter. Java is a typical example. Java source code is compiled to Java byte code suitable for interpretation by the Java virtual machine (JVM). Thus a JVM is required to execute Java programs. Unlike native machine code, byte code is portable; the same byte code will execute upon any machine that has a suitable interpreter available.


What are high- level languages?

High-level languages are languages that have little or no dependency upon the machine architecture. Code is written with a high-level of abstraction (hence they are classed high-level) which makes it much easier to port the same source code to any machine that has a compatible compiler or interpreter to produce the low-level machine code. Low-level code is non-portable code. Some languages, including C and C++, are both low-level and high-level, often classed as mid-level languages. These languages allow programmers to write both portable and non-portable code within the same program. However, the non-portable code can be rendered portable by crafting alternative versions of the non-portable code for each supported platform, filtering them through the use of precompiler directives. In this way, the compiler only sees the code that is specific to the platform and will compile accordingly. Java is an extremely high-level language that is both compiled and interpreted. Unlike normal compiled languages which compile to machine-dependent code and therefore need to be recompiled separately for each supported platform, Java compiles to byte code which can then be executed upon any machine without recompiling. To achieve this, the target machine must be running an interpreter program known as the Java virtual machine (or JVM) where each physical machine has its own implementation of the JVM. In other words, source code is targeted towards the same, non-physical machine. The upside is that compilations are highly portable. The downside is that Java programs do not perform well compared to their compiled language equivalents and are only suitable for high-level applications software (you cannot write low-level software such as operating system kernels and drivers).


How is it possible that the same Java program can run on different platforms?

Java source code is compiled into .class files, which are used by the Java Virtual Machine (JVM). The format of the .class file is the same for all platforms, and so the source code can be compiled the same way on each platform. The JVM, however, needs to be written to run on a specific platform. This is the part which converts Java bytecode to native bytecode, and is why you need to download the JRE (which contains the JVM) for a specific platform. Java source code is compiled into .class files, which are used by the Java Virtual Machine (JVM). The format of the .class file is the same for all platforms, and so the source code can be compiled the same way on each platform. The JVM, however, needs to be written to run on a specific platform. This is the part which converts Java bytecode to native bytecode, and is why you need to download the JRE (which contains the JVM) for a specific platform.