Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Study Notes of C++ (1)

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Starting from today, learning Clearing skills and mastering a programming language will benefit a lot from both subsequent language learning and future work, so study hard and forge ahead. There will be something to do in the future.

The production of Key Point 1RU Cymbals +

(1) "C language Source"

C++, which comes from C, is a superset of C. It has a deep relationship with C, so before introducing C++, let's introduce C.

Background: an early programming language, a machine language, (Machine Language), an assembly language (Assembly Language). Although these two languages have the advantages of high execution efficiency and program instructions can access the underlying hardware. But they are far from enough in terms of readability, portability, and problem description performance. Moreover, coding is torture for programmers.

In the 1970s, Dennis Richite, the "father of the C language", worked on the development of Unix OS at Bell Labs (the creation of Unix is not described here). To this end, Ritchie needs a language, it must be concise, efficient, can generate concise, fast programs, and can effectively control the hardware.

Traditionally, programmers use assembly language to meet these requirements, which depends on the internal machine language of the computer. But, assembly language is low-level language, that is, it is targeted at specific computer processors. Therefore, in order to migrate assembly language to another computer, you must rewrite the program in a different assembly language. It's like every time you buy a new car, you find that the designer has changed the position and function of the control system, and the customer has to learn to drive the new car again. However, Unix is designed to work on different computers (or platforms), which means it is a high-level language. High-level languages are dedicated to solving problems, not to specific hardware.

A special program called a compiler translates a high-level language into the internal language of a particular computer. In this way, you can use the same high-level programming language on different platforms by using different compilers for each platform.

Ritchie hopes to have a language that can combine the efficiency and hardware access ability of low-level languages with the versatility and portability of high-level languages, so he developed C language on the basis of the old language.

(2) "C++ production"

The emergence of C language has made great progress, as can be seen from Unix OS. But with the development of technology, he also encountered a bottleneck. (it seems that the problem with IT technology is inevitable, but the change is a little too fast.) the style of C language determines its shortcomings.

Generally speaking, computers deal with two concepts: data and algorithms. Data is the information used and processed by the program, while the algorithm is the method used by the program. C language is a process-oriented language (procedural language), which emphasizes the algorithmic aspect of programming. Conceptually, a procedural programming language first determines the actions taken by the computer, and then uses the programming language to implement these operations. The program commands the computer to generate specific results according to a series of processes, just as the recipe sets out a series of steps that the cake cook should follow.

However, with the expansion of program scale, early programming languages (FORTRAN & BASIC) will encounter organizational problems. The execution path is confusing, readability is almost impossible, and it is troublesome to modify. To solve this problem, computer scientists have developed a more orderly programming method, structured programming. It restricts branching to a small group of well-behaved structures (for loop,while loop,do while loop,if else sentence in C). Another principle is to adopt top-down design (top-down). The problem is divided into several sub-problems or sub-modules, which is easy to manage.

However, when writing large programs, there are still challenges. OOP provides a way to meet this challenge. Unlike procedural programming, which emphasizes algorithms, OOP emphasizes data. OOP allows the language to meet the requirements of the problem, rather than the procedural approach of procedural programming to make the problem satisfy the language. OOP's philosophy also designs data formats that are relative to the nature of the problem.

In C++, a class is a specification that describes a new data format, and objects are specific data structures constructed according to this specification. Class represents exactly what the program is dealing with. The process from a low-level organization (class) to a high-level organization (program) is called bottom-up programming.

Based on this, C++ was born in Bell Labs in the 1980s, which was developed by Bjarne Stroustrup ("the father of C++"). The follow-up standardization work provides great help for the development and application of C++. Reality has also proved that C++ is a powerful programming language. (with the deepening of learning, gradually realize its strength.)

Note: 1) the future study of Unix OS

2) top-down vs bottom-up

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report