display | more...

A computer program is said to be source portable if it can be transferred from one software- or hardware platfform to another without having to be rewritten from scratch, i.e. by just taking the source code and compiling it for the target platform. Usually, a program that does anything of interest is never fully source portable, because such programs often communicate with the hardware via the operating system in some platform specific manner. With the advent of the POSIX standard, many user space programs that were written in C became source portable between operating systems that support this standard. An example of partial source portability is the Linux kernel. The kernel can be compiled for different processors like the i386 (the common P.C.) and the PowerPC (the Macintosh), to name a few. Only the most basic parts of the kernel are written in platform specific assembly code.

By similar definition, a source portable programming language is a language that is supported on multiple platforms, but which does not produce fully portable executables. The most obvious example would be the C language. Programs written in C can be compiled on many different platforms, provided they don't use any platform specific features. It is however impossible to compile a program on one platform, say Linux, and then run the executable file another platform, say Windows, without recompiling it on that platform.

By contrast, programs written in languages like C# or Visual Basic are not source portable because there are no compilers for these languages on other platforms. Assembly language programs are generally not source portable either.

On the other hand, source portability is not the same as full portability. Programs written in the Java programming language are fully portable. This means that a program written and compiled in Java on any platform can be executed on any platform, without a need to recompile.

Log in or register to write something here or to contact authors.