Which programming languages are cross-platform?

Source: Internet
Author: User
All say that Java is a cross-platform language what is cross-platform language? I think the PHP C language can also be developed under different platforms. What languages are cross-platform? Is there a difference between their cross-platform features?

Reply content:

The cross-platform of Java is "compile once, run everywhere". Java at the time of compilation is not compiled to the specified CPU type assembly code, and the specific operation system calls associated with the system, so the results are compiled with the CPU, the operating system is irrelevant. Java compiles a byte code that must be run on a Java virtual machine, and Java Virtual opportunities mask differences between different operating systems and CPUs.

C compiled out, is to specify the CPU type assembly code, the compilation process must also be related to the specific operating system of the system library, so do not have the kind of cross-platform Java. However, if you write C code that does not call any system calls directly, this code can be compiled and run under different platforms. The difference with Java is that C is compiled separately on different platforms.

Some languages such as Javascript,python, they are interpreted to perform, there is no compilation process, so can also cross the platform, if there must be a corresponding interpreter, PHP seems to be explanatory. The language cross-platform is built on top of the non-cross-platform infrastructure
such as the standard library for C + +
Java Virtual machine,. NET Runtime
These are not cross-platform in fact now discuss cross-platform meaning is not big, so-called cross-platform language, that is, you write code, can be applied directly to another operating system, or even the CPU without modification.
But now almost all languages are like this ... C/c++,java,c#,python,php,js,ruby,go ... Wait, wait.
Java says that it is cross-platform, because it is compared to C, compiled binary files can be in any other a platform with a Java operating environment installedTo run, note, if not installed, then take a break. and C, the compiled things can only run on a class of operating systems, change the ground, but the run-time no additional installation of the operating environment is required, however, you can still compile a separate copy of the specified CPU and operating system.
In addition C#,python,php,js and so on all can be a code on a variety of platforms to run directly. But they all need the appropriate operating environment。 It's time to show me the big JavaScript!

You have to use JS if you can surf the Internet.

Mobile phone running WebView, of course, relatively high force lattice is react-native.
Game Canvas
Even single-chip microcomputer can write, although the function is relatively weak bar.
PC side, now there are many with electron.
Browser... Speak out, which language wants to be abused.

I think the meaning of "cross-platform" should be just the interface aspect.
After all, the server side is almost Linux world. Writing server-side software is not a Windows version.

Please believe it! Interface UI This piece must be JS or its derivative language of the world! The cost of Java cross-platform developers is minimal, and once compiled runs everywhere. C language, Python and php Some of the features to use some operating system specific functions, the development cost is relatively large.
In fact, many languages now have a certain degree of cross-platform capabilities, but in fact, there is no egg, like Java and H5, such as the cost of cross-platform use, most of the experience is not good. Cross does not span meaningful, can be very important to do things out of the first, and then in C to rewrite the heavy performance module. Now strictly speaking, no language can cross the platform. You say C # Bar, open source, said Swift, also open source ... First of all, the portability is not called cross-platform, many people are easy to confuse the concept.
The biggest feature of cross-platform language is not compiling machine code, not using System API.
1. Do not compile the machine code, because different environment CPU different, although the PC is x86, but if not the PC but the mobile phone, then the CPU instruction set is not x86, then your machine code is all useless, can not cross the platform.
2. Do not use the operating system API, very simple different system API definition, different usage, soft interrupt vector different, generally use the system API to create threads, create process code, code will not be universal.
Java runs on the virtual machine, the compiled code is the JVM is running, the logic is directly run by the CPU, as long as the hardware installed JVM, then do not need to care about what the CPU, the same time he put the system API into a common Java library, although the system is different, but the system kernel do is to do similar things, encapsulation, is also used everywhere, so no problem, and the above mentioned QT, is to rely on this encapsulation unified implementation of cross-platform or portable, but the problem is that QT is not a programming language, so irrelevantly replying ...
But the language itself across the platform does not mean that the code cross-platform, or the PC and Android will not write two versions of Java, because many system resources want to all in a unified package, this workload is very heavy, but also easy to bring some negative effect, this is to pay the price, There is no return (such as Microsoft doing a support Android VS, and can run on the PC, to do this return to where?) is also possible to be the program developers think grandstanding, meaningless, do two apps do not calculate the problem, both appear incompatible bug is the problem, There is no return to do this work for the benefit of mankind, so Java a compilation everywhere running, looks very beautiful, actually just a sentence, but this does not prevent the Java is a cross-platform language, but the work did not do in place.
Another cross-platform is called the macro language, many of these languages are not compiled, such languages are usually limited scope of work, such as specifically to engage in Web pages, specifically to engage in databases, as well as the flash as script, and so on. Take HTML, he is not compiled, after all, he is only an agreement, the language is to use text to describe the Web page, a browser to implement this Protocol, it can achieve Android version, PC version, Apple version of the browser, but all recognize HTML script, then HTML is a cross-platform language ... Other such language is also the same, the image said they are an abstract protocol, need to execute their app or service to run them, as long as the developers in accordance with the agreed protocol to do the program, the language is cross-platform, but this macro language, functional scope is limited ... Must be QT ah. The role of programming language is only to describe the algorithm, if it is not to optimize or to translate themselves, then it is not my business how to translate
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.