Relationship between C ++ and other programming languages

Source: Internet
Author: User

Readers may be familiar with the basic concepts of programming and programming languages. The following describes some terms used in this book in a general sense and describes the relationship between C ++ and other programming languages.

No matter which programming language is used, the program written is composed of various commands. These commands are called source code and stored in the disk's source file. At present, there are many programming languages, each of which has its own advantages and disadvantages, all of which have its own advertiser and critics. In addition to C ++, you must have heard of programming languages such as BASIC, COBOL, FORTRAN, PASCAL, and C.

For example, the FORTRAN language has nearly 40 years of history and is still widely used in Science and Engineering Computing. However, C ++ and other languages have gradually entered these fields. The COBOL language is specially used for business data processing applications. Its History is almost as long as that of the FORTRAN language. Currently, there is almost no need to write new code in COBOL, but a large amount of code written many years ago is still in use. C ++ has gradually become an optional language for many business data processing programs.

C is the predecessor of C ++, because these two languages have many common syntaxes and functions. In fact, the C programming language is a subset of C ++. However, C ++ has made many extensions and improvements in the development process, making it a mature language. In addition, C ++ is more powerful than function and more widely used.

1.1.1 execution of interpreted and compiled programs

The purpose of a programming language is to describe the actions you want a computer to perform more simply than programs that can be executed by a computer. A computer can only execute programs that contain machine commands (also known as machine code) and cannot directly execute programs we write. There are basically two ways to execute a program written in the aforementioned language. In most cases, one language selects one of them. For example, a program written in the BASIC language is usually interpreted, that is, another program called interpreter checks the BASIC source code, determines what the program is going to do, and then let the computer complete these actions. See Figure 1-1.

Figure 1-1

C ++ is a compilation language. Before executing a C ++ program, you must use another program (that is, the compiler) to convert it into a machine language. The compiler checks the C ++ program and generates machine commands to execute the action specified by the source code. Of course, the interpretation and compilation are not as simple as described here, but the working principle is as follows.

When an explanatory language is used, the execution process is indirect. That is to say, the source code intent needs to be determined each time a program is executed. Therefore, this language is much slower than the execution speed of the program corresponding to the compilation language, and sometimes it is 100 times slower. Any language is either explanatory or compiled, which is usually determined by the design and usage of the language.

An exception to this rule is Java, which is a quite new language and has many features of C ++. Java is basically an explanatory language because it is mainly used for porting between different computers and on the Internet. Even so, there is also a just-in-time compiler that can generate the corresponding machine code for the Java source code during execution, which greatly improves the execution speed.

1.1.2 Database

Every time you write a program, it is very cumbersome to write it from the beginning. In many programs, the same function is often required, such as inputting data on the keyboard or displaying information on the screen. To solve this problem, the programming language provides a lot of pre-written code to execute standard input/output operations, so that you do not have to rewrite the code.

The standard code that can be used for any program is saved in a library. Libraries attached to programming languages are as important as the language itself, because the quality and scope of use of libraries have a significant impact on the time required to complete a programming task.

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.