View Single Post
Old Aug 18th, 2005, 6:44 AM   #26
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,051
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by CodeJunkie
Ok .... I guess what im trying to ask is... Whenever i have written programs in C or in Java despite compiling them various diffrent ways, whenever i try to run these on a diffrent platform they fail.... with varying errors.....
I guess what im tyring to find out.. is that when you purchase an application and attempt to install it , when you click on the icon the computer doesn`t display that "Exception in thread etc" or "Please install such n such", I guess what im trying to achieve is to find a programming language that intergrates with most machines.... that does run, when the user clicks on the icon my program is compatable with there machine... Is this to much to ask?, How do developers get round these issues?
You're talking about portability of the compiled/assembled code, rather than portability of the source code? Good luck. Outside of emulation, this is just not possible.

Every machine has its own hardware. First and foremost, you have different CPUs with radically different architectures, meaning they have different (even though often equivalent) machine instructions, they access memory differently (little-endian vs. big-endian byte ordering, memory alignment, amount of addressable memory), and other capabilities. Then you have the supporting hardware, such as the motherboard chipset and all peripherals. When I was younger, I had a computer based around Motorola's 68000 microprocessor. After I'd had the machine for some years, a friend pointed out his laser printer used a 68000 as well- it's essentially the same brain in different bodies; while both would understand the same machine instructions, code written for one would not work on the other.

Then you've got the issue of the operating system, if one exists. To do a task under Windows will require different code than under DOS or Linux, even on the same machine.

This is where languages like Java come in. Java code is essentially code targeted at a machine that doesn't actually exist, and the 'Java Virtual Machine' that you install to run Java programs is really just an emulator for this imaginary machine. The designers came up with a specification for the machine, code libraries, etc, and in theory, any compliant virtual machine should execute the code in the same manner. Of course, this is the ideal situation; in the real world, it sometimes doesn't work quite so smoothly.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is online now   Reply With Quote