Contents
What makes compiler portable?
You could make a compiler for a particular target machine -or language- (and that machine might even be something like LLVM or GCCJIT or Parrot which provide portability by defining some abstract model or intermediate language).
How do I create a portable code?
- Keep several compilers nearby, test code regularly on target platforms.
- Do not rely on sizes of standard types.
- Do not use compiler-specific pragmas, macros and extensions.
- Do not use extensions to standard library (provided by compiler developer).
Why is C++ not portable?
C++ programs have a less standardized environment closer to the actual hardware, so the program needs to be able to handle the various platform specific details – like size of an int, word alignment etc etc etc. The JVM itself is not very portable.
How portable is C++ code?
So c++ executables will never be portable (unlike Java). On the other hand, porting the compiler can sometimes be enough. The community has found that by porting the compiler as well as some core libraries of the language, source codes (and not binaries) could be portable.
What does portable code mean?
Portable code is code that is not tightly coupled to one specific platform, or which is coupled as loosely as possible to platform-specific APIs. It is “portable” in that the amount of work required to move it from one platform to another is low.
Is C++ more portable than C?
C is much more portable. Good C++ compilers exist only for the most popular platforms, while C compilers exist for just everything, even the most exotic hardware / OSes.
Is Java more portable than C++?
Java programs are very portable, because the JVM provides a standard behaviour guaranteed to be the same. C++ programs have a less standardized environment closer to the actual hardware, so the program needs to be able to handle the various platform specific details – like size of an int, word alignment etc etc etc.
What is the first C compiler written in?
Portable C Compiler
| Original author(s) | Stephen C. Johnson |
|---|---|
| Initial release | 1979 |
| Stable release | 1.1.0 / December 10, 2014 |
| Written in | C |
| Operating system | Unix and Unix-like |
What is portable C code?
The Portable C Compiler (also known as pcc or sometimes pccm – portable C compiler machine) is an early compiler for the C programming language written by Stephen C. Being one of the first compilers that could easily be adapted to output code for different computer architectures, the compiler had a long life span.
Is Python a portable language?
Python is Portable language: Python language is also a portable language. For example, if we have python code for windows and if we want to run this code on other platforms such as Linux, Unix, and Mac then we do not need to change it, we can run this code on any platform.