0

not sure if this is a right place.....but what exactly does it mean if a programming language is portable?

6
Contributors
16
Replies
17
Views
7 Years
Discussion Span
Last Post by 0x69
0

Generally it means not too many assumptions on underlying computer, for example ltitle or big endian, or operating system services.

0

so as longs as its compiled for a certain CPU architecture (say 80x86) it will run on every computer that uses that type of CPU?

0

Portablity is not usually considering only raw iron but also operating system. The content of those registers can be filled somehow and the results must go somewhere.

There is standard C programs of very simple nature, but still they must be compiled according to operating system. Interpreters are themselves big programs that need to be installed in the operating system to offer programming language and access to underlying operating system.

If you have calculation routine in 80x86 of course it is possible to utilize that routine from different operating systems and programming languages, but that is library routine and not connected closely for portability issue.

0

if someone rote a program that didnt use any os services or interact with the os in any way.....would it run on all computer(same cpu architecture) no matter the os

0

Yes, say math library, but it would need to be linked to other parts of program which make the connection to actually use it.

That math library would be quite challenging to write efficiently to use with different processors (even variants of x86) and order bytes in memory, level of floating point support in processor....

-1

what if someone wrote a program that used no liberies of any kind. then would it run on all?

0

Sure it runs, for example simple controller which reacts button push from one input and gives result from other pin in processor. Program would be one loop waiting button press to happen.

The program would not be portable because it would be expressed in low level assembler with certain numbers for input/output pins, type of controllers communicating...

0

what about something in c or c++. are those "portable" launguages?

0

what about something in c or c++. are those "portable" launguages?

Can you use C or C++ on different kinds of computers?

0

C (and maybe C++) are considered very portable. For example, one of secrets of success, and wide availability to different computers, of Linux is relying much only C coding with minimal assembly language.

0

C and C++ are considered to be very portable but compiler differences can be significant. A language like perl or J is probably much more portable in practice for a wide range of programs across different OSs.

1

There are different degrees of portability. Probably the best you can hope for in terms of portability is a language that either runs on a virtual machine (then your code is as portable as there are virtual machines for different computers) or in an interpreter (ditto, for interpreters) and even then if you try to do hardware or OS specific things, it won't work. Examples:

portable: a Java program that has two integer variables declared statically at compile time, with values A and B, and the program computers the average and puts the answer in a third variable declared at compile time initialized to 0.

not portable: a program written in assembly language that controls a robotic arm and hand and saves the data in a parallel file system across a distributed network of heterogeneous hosts. Oh and it does some vector processing on the side.

0

not sure if this is a right place.....but what exactly does it mean if a programming language is portable?

It means that there exists compilers/intepreters of that language for many different kinds of computers/OS.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.