C ++ starts from scratch (1) - What is programmed?

xiaoxiao2021-03-06  70

introduction

Some people have asked me questions, asking some very basic questions, but these people can use the VC to make a dialog interface to perform the necessary operations or document / vision interfaces to receive port data and dynamically display the curve. (Also used multithreading technology), but even the basic problems are unclear, and the most serious consequence is to cause poor code (although it is multi-thread, but I don't dare to compliment), I don't know the meaning of the class. Mixed uses various available techniques to achieve purposes (all of which are used in place of the selection statement), the code logic is confusing, and it feels like the translation of Jinshan. I think anything is the most important, and I will no longer be a programming work after I finished my custom project, and I have no significance of these experiences. I will tell me in this series. For programming, helping people interested in computer programming quickly (but maybe not imagined so fast). Since I never read a book of C books (all of the zero clustered occasional flooded), and this series is not a dogmatist and explains the names and their explanations, but hopes that readers can understand programming. Instead, I am learning a language (ie, I will not only turn over the Han, and I will also turn over the English). The entire series is written in all my own understanding, and there is no reference to other textbooks (in some foundations or refer to MSDN), the content in this series may have inconsistent with the classic textbook, but their essence should still The same, just the angle. This series does not carefully explain each keyword of C (some is not important), after all, the purpose is not a C language reference, but the programming. If there is not mentioned in this series, please refer to the C language reference in MSDN (you should have the ability to do this after reading this series), and the content given in this series is compiled with VC. Based on the 32-bit Windows operating system. The title and main content of each article are listed below, and the title of the red modified article indicates the focus I think.

C from zero (1) - What is programming (explaining the real meaning of programming and two important but easily ignored basic concepts) C from zero (2) - what is the expression (indicating the use of each operator, but Not all, the remaining will mention other articles) C from zero (3) - What is called variable (describing the computer's working mode, elaborating the most important concept of memory, address) C from scratch (4) - assignment Operators ("C " continues from scratch (2) ", and is a bit based on the explanation of the pointer) C starts from zero (5) - what is pointer (elaborating pointers, arrays, etc.) C from scratch ( 6) - What is statement (explaining the various statements provided by C , indicating the reason) C starts from zero (7) - what is the function (description function and its existence) C from zero (eight) - C Sample 1 (give one or two simple algorithms, step by step) How to write C code from the algorithm) C from zero (nine) - what is the structure (brief description, enumeration, etc.) C from Scott (10) - What is class (explanation, definition, header file, etc.) C from scratch (11) - class related knowledge (explanation, inheritance, name space , Operator overload, etc.) C from scratch (12) - what is object-oriented programming idea (explain what is described as programming, focusing on object-oriented programming ideas) C starts from scratch (13) - C sample 2 (explanation how Design C program based on object-oriented programming ideas) C starts from zero (fourteen) - what is template (explaining template technology and its existence) C from zero (fifteen) - what is abnormal (explained abnormal technology Reasons for existence) C starts from zero (sixteen) - what is precompiled instructions (indicating the concept of pre-compiling instructions and several commonly used instructions) C from scratch (sevente) - C some of the legendary keywords (Explicit, Mutable, Volatile, etc.) C from scratch (18) - What is SDK (indicating why no music instructions can still be able to make music) C from scratch (19) - What is the C of the C (twenty) - a little basic knowledge of the VC (twenty) - a little basic knowledge of VC (

Note Several basic concepts of VC and some common settings) C start from scratch (21) - C sample three (using VC to write a simple program to achieve polymorphism through DLL)?

The program, that is, the order of the process, accurately, should be a plurality of processes arranged in order, which is a description of the method. For example, eat vegetables, first pick vegetables with chopsticks, then send vegetables into the mouth with chopsticks, and then chew and swallow. The clips, send, chew and swallow are called commands, while the dishes are resources, such as shapes, locations, etc.) as the command is executed. The above is a description of the method of eating a dish, which is the process of eating vegetables. Any method exists to change the state of certain resources, so any method is described, that is, the program, and there must be a command of this thing and the resources they have. The command is implemented by the executor of the program, such as the vegetables above, the clips, delivery, etc. are implemented by those who eat vegetables, and the resources must be what the executor can change, but the order is just telling How do executers change. The computer program is the same as above, which is a description of the method, and these methods are what people can do (notice that the computer is going to do. This often has been confused by many people). When people need to do these things, people need to do things Give some resources to make the computer to do correct changes. If the program is calculated, it is only the description of the method, it is not any utility until it is executed, and the human given it a piece of memory (for memory, please refer to "C from zero (3)"), tell it After the accuracy of the calculation results and the storage position of the calculation result, it changes the status of the person a given memory to exhibit calculation results. Therefore, for the computer program, the command is the directive of the CPU, and the executor must be the CPU because it is an instruction of the CPU, and the last resource is that the CPU can change its state's memory (of course, such as port, etc., but The general application uses a large number of inner stages). Therefore, the computer program is a description of how the computer changes a given resource (generally memory, or other hardware resources), note that it is not any meaning, unless it is executed.

What is programming?

Programming is written programs, that is, the development method. Why have you had a way? The method is to illustrate. There is a lot of reasons why there must be, but the root cause of computer programming is because the language is different, but not only different, even the concept is not connected. The human language is five flowers, but it can be positivelighted by translation, because human beings are survive in the same four-dimensional physical space, with the same or similar perception. The space and physical space that the CPU that the computer program is executed is serious, so it is impossible to translate computer programs into a description of human language. This is important, which has led to the poor code written by most programmers, because people think that there is no commonality they want, so they randomly watched it when writing programs, which in turn leads to poor but can be implemented. Code. The computer's language is the CPU instruction, because the CPU has this perceptual approach (accurately said that there is memory location, interrupt response, etc.), unlike human beings can have physical languages, the computer program is a method of writing human language Translated into a corresponding computer language is a translation process. This is completely different from the general translation, because the previous red word, it is impossible to translate. Since it is impossible to translate, is the computer programmed? Consider a carpenter, I am a guest. I said to the carpenter, I want a rocking chair, lying very comfortable. Then the carpenter began planing the wood, and made a rocking chair under a special curve to ensure that when I shaken, the focus was always unchanged. Here I have compiled a simple program, only one instruction - make a very comfortable rocking chair. The carpenter translated my program into a planing wood, design a series of procedures I can't understand. This is the case, here is because the space and woodworking of my life (the woodworking process, not a carpenter) has no commonality. The carpenter is equivalent to the computer programmer and CPU (because the carpenter's craft is the CPU's command definition, while the carpenter translated my procedures into some procedures for woodworking, by the carpenter through its craft To implement these procedures, that is, execute procedures. Due to the space and woodworking of my life (referring to the woodworking process, not workers), it is impossible to translate, but the above translation is successful, it is actually not translated. In the eyes of the woodwork, the rocking chair is just some straightforward and curved stitching, because the woodworking space does not have the concept of rocking chairs at all, but I want to treat the pile of wood as a rocking chair, and use it. If I treat the pile of wood as a weapon, it is a weapon, not a rocking chair. "Nonsense concession plus fart!", Maybe you will call it, but computer programming is such a thing. The CPU can only sense the instructions and changes in memory (do not consider other hardware resources and responses), if we write a program calculating the percentage, a single memory is given, execute, and after the completion, see the computer screen display correctly result. However, it must be noted that the computer actually copies, adds a number of memory, adds, and multiplied, and the computer does not know that is the percentage, and if the executive person does not say it is the circumference, then the result is not a circular rate. Maybe a random number or anything else is just that the luck is very good and the circumference rate is amazing. The above things I will be called semantics, namely the meaning of language, but it is not only applicable to computer programming, but also many technologies, such as machinery, electronics, mathematics, etc. have their own language, and those designers are responsible for The customer's simple program is translated into a procedure described in the corresponding language.

As a programmer, it is extremely necessary to understand the importance of semantics (I am in my other article "Semantic needs", in the case of the code-level semantics, interested in referring to it), In a subsequent article, I will also mention semantics and their impact on programming. If you have not understood what it means, with the reading of subsequent articles, it should be more and more clear. Computer programming basics - compilers and connectors

I have never seen it (but there should be) any C textbook has a compiler (Linker who has seen it in very old C textbook), now I have passed a similar VC. The programming environment hides a lot of things and packages them. Here, it is very important to understand their understanding. This series will be used in large numbers of vocabulary, which determines whether it is very important to understand, definition, external variables, header files. The computer programming is a "translation" process. To translate the user's program into a CPU directive, it is the machine code. The so-called machine code is a program written by the CPU instruction, called a low-level language. The programmer's job is to write out the machine code. Since machine code is completely some of the numbers (everything of the CPU perception is a number, even the directive, only 1 means of adding the number and working map of the subtraction, the number of work), people should remember 1 is the addition, 2 is a representative subtraction will be more difficult, and also remember that the percentage of the third block is the circumference rate, while the 4th block is put in the valid bits. So invented the assembly language, use some symbols to represent the addition without using 1, and use add to represent addition, etc. Due to the use of assembly language, people are easier to remember, but the computer can not understand (it only knows 1 is addition, I don't know how add is an addition, because the computer can only see the number), so there must be something to translate the assembly code into a machine Code, that is, the so-called compiler. That is, the compiler is a program that translates a language into another language. Even if the assembly language is used, since it is almost just a number of digital maps in the CPU command to help memory, it is not enough to think about human thinking habits, so there is a complexity. Computer programming language, such as: Pascal, Basic, C, etc., is called high-level language because comparing the approach of people's thinking modes (especially the concept of the concept of C ), and the assembly language is called low-level languages ​​(C It has been called a high-level low-level language) because they are not very in line with human thinking model, and human book is more difficult. Since the CPU does not know the symbols of these PASCAL, BASIC and other language definitions, there must also be a compiler to convert the code written in these languages ​​into machine code. For the C language here, the C language compiler (later compiler refers to the C language compiler). Therefore, this so-called compiler is converted to the C source code written into machine code. Since the compiler executes a conversion process, it can be optimized for the code we have written, that is, it is equivalent to a CPU instruction programmer, translates the program we provide into machine code, but its work should be simple. This process has been completed by the programmer because the process of translating the programmer, while the compiler is only translated by the programmer (up to some optimization). There is also a compiler called a translator, and the difference between the compiler is that it is dynamic and the compiler is static. As the previous Basic compiler is called a translator in an earlier version, because it is real-time translation in the running period, and unlike the compiler to turn all code to machine code. For those such as "dynamics", "static" and "running period" here, do not deliberately understand it, as well as reading of subsequent articles.

转载请注明原文地址:https://www.9cbs.com/read-87673.html

New Post(0)