A brief discussion on "cross-platform"

Source: Internet
Author: User

Both standard C and standard C + + are source-level cross-platform, meaning that code written in standard C + + will run under Windows after it is compiled under Windows, and can be run under unix/linux after compiling under Unix/linux. C language can cross the platform mainly because each platform includes Dos,windows,linux,unix and so on have C compiler, as long as the source code is the same, the compiler compiled binary files will achieve the same function (not including cross-platform system calls). However, these binaries are not the same, and the executables in Linux generally do not run in Windows because they are two completely different operating systems, with different cores and different system calls. However, the compiler generates different code based on different platforms, allowing the binaries to run in a proprietary platform and implement the same functionality.

In short, C source code is cross-platform and compiled target files and executables are not cross-platform, cross-platform mainly rely on the compiler on each platform.

In the era of the use of assembly language, each manufacturer has its own assembly language, then the computer program and machine binding, not the same manufacturer's program in other manufacturers of the platform can not run. Until the C language appears, we can change the C language Program source files under the X86 platform to run directly after the power platform is compiled. Therefore, the cross-platform porting function of C refers to the portability of hardware architectures. The cross-platform capability of Java means that it does not need to specify that the operating system can run directly.

C Language "Write once, compile everywhere", Java is "compile once, run everywhere".

As C + + founder Sour, the JVM has created a new platform for all Java programs to run on this platform, while C and C + + code can run on dozens of different platforms, from this point of view, C and C + + are cross-platform, and Java is not.

The above content from Baidu know, I do record.

A brief discussion on "cross-platform"

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.