Summary of C + + programming in my eyes-20150602

Source: Internet
Author: User

Intermittent learning a lot of things, there are 51, AVR, ARM, PLC, C\c++, C #, TB, MC, Mql4, Linux .... And so on, near spoon or swallowed, even hungry wolf-like flutter into the inside, slowly accumulate and understand, very many knowledge points have perceptual understanding, more or less understand some, perhaps for memory. Gather these knowledge points. A summary of the nature of the stage

Also very welcome experts from various industries or the great God can find some of this article I understand the error, can give me a message, because I am lack of a lot of knowledge of the overall grasp. Just take it for granted, it's understandable, and some of it has been checked for information. Some may not check the data or no information to check, because it is not a professional trained, also did not learn too much text rhetoric, so said almost plain English. That's how it's done.

1: From microcontroller to compiler speaking

For each compilation requirement, the compiler installed on the computer is mainly dev-c++. Vs2012,keil V5. And the GCC under Red Linux and Linux under the virtual machine.

It's more or less keil,vs2012. GCC these three models

Sometimes thinking, what is a compiler, why do I define a printf under. The characters in the specified format will be displayed on the screen.

First we have to go back to the single-board machine, I understand the single-board machine is a control chip + a bunch of peripheral circuits. And I used the Keil compiler. It includes the corresponding header file of the control chip, the header file will be very much input and output port all defined as readable macros and variables, and the frequency of the crystal oscillator to achieve the program cycle. The oscillation frequency of crystal oscillator determines the operation speed of single-chip microcomputer, and of course it is related to the design of the control chip itself. For example, more than 24MHZ crystal oscillator can be error and so on, with this control chip, the control chip inside a very many registers. And the earlier compilers. is through the simple machine code writing, PLC on the interface voltage similar. Output the voltage and current of each pin to control the circuit

But because the machine code is difficult to write, and particularly cumbersome, may later developers will be some of the interface group classification, packaging, and then in the overall interface to achieve jump, similar to the assembly language now, such programming has greatly conquered the problem of machine code writing. However, it is closely related to the hardware, and the readability is not good, the requirements of the coding staff is higher. This time is roughly 1965 years or so.

Later appeared the B language, I have not contacted, plus the control chip of the single-board machine and the peripheral circuit of the increasingly intact, hardware has appeared more complex logic, through the compilation May project volume is particularly large. And particularly not easy to maintain, B-language may be more abstract, he may have defined some basic data, possibly in order to circumvent some of the shortcomings of the Assembly. Defining some data to read and write to registers is a very big step forward, and it could be that the assembly and the B language are excessively different languages, at least the idea is a qualitative change that frees people from the duplicated machine port.

b language developed for several years. His problems may also show up slowly. After all, it is only a matter of solving the assembly, in about 1971 years. A group of American testers improved the B language, or simply used the idea of a variable or constant in B language. The B language is more normative, or directly developed there is a B language, but they are named C, because they feel this more abstract. More standardized

Single board machine or hardware aspects more intact, control chip logic more strong. The abstraction or readability of C language has been widely applied immediately.

Here's the main difference between the C language and the B language and the assembler: Of course, this is also a personal understanding of the two languages I also understand a little. Experts are also welcome to correct

The assembly is mainly to define the jumps between the various registers, and according to the function of each register, for simple operation, it is based on the hardware aspect of the computer to accept and manipulate the contents of the register, so that time the program ape. Need to understand jumps and operations between registers, hardware-based limitations are relatively high

But the C language may have changed this, and its design philosophy was designed from the hardware. It defines some special data types, such as shaping, 4 bytes, to specify the data of some columns of the two-tier system, which is implemented by the compiler kernel, which defines the data type of the bool type to represent the non-gate, about the decimal, and it once again has a fractional storage standard. Double and single precision are defined, and 8 bytes of memory space are left for this data type. It also specifies the rules for memory alignment. Anyway. These are the things that a compiler needs to define, probably in the standard library of the programming language, and then for compiling the generated files, the compiler must also have connectors that will generate the two-level files and hardware connections of the machine, the standard of the connection, the various development languages have clear specifications, so say C or B language, Separating the compilation environment from the hardware, and making a series of data types, and using some operators to write these data types to the hardware, this is probably what we call stack knowledge, compiled into binary files by compilers, and then connected via connectors

Therefore, the emergence of C language, or the development of C language concept, can be said to be a great progress in programming.

The whole time was 1979 years ago.

After several years of development, the hardware of the machine has a very big development, and the hardware aspect may have already appeared the multistage differentiation

As of the 80 's, the computer environment was roughly the following: China just opened the university. That's when Apple and Microsoft have not yet appeared. Bill Gates may be developing a DOS system, and IBM is still the boss of it. Jobs may still be in school. The hardware has evolved to a diversified level. The same American college students are preparing their graduation papers. He may think C is bad for the language. It's not clear how the object-oriented mind is in the minds of today's college students. He started to improve the C language. The class, inheritance, derivation and other attributes are added on the basis of C language. The C language from the previous process of direct object-oriented, such an object-oriented thinking, is definitely not simple to add the characteristics of simply, is a total change of thinking, personal feeling C language is to weave the world into a net. But C + + completely divides the world into chunks.

After many years of development, the United States has set up the C + + Standards Committee, which specializes in C + + standards. The standard became a standard in 98, followed by the 03 version number 11. No mention here.

The hardware has developed rapidly. began to diversify, with the previous simple control chip. Developed into today's computer CPU i7,e5, simple peripheral circuit. There are also diverse, original control keys developed out of the computer keyboard. The EEPROM may have been upgraded to today's machinery and SSD, and the clumsy 1602 may be a process for many of today's displays. There are 8 of g,16 a temporary data storage device, of course, but also developed elsewhere, for example, Mitsubishi PLC board, walking is the industrial line, mobile phone control chip is a different branch

The middle of the 90. Very many other languages have appeared. There are a lot of programming languages that are cumbersome and complex to do with C + +. More convenient to achieve customer development

The C + + aspect appeared vc6.0. Dev-c++. Multiple programming environments such as GCC

What does 2:c++ include?

This is the core of the text I wrote. What is it that needs to know what C + + is a master C + +?

The previous general understanding of C + + concept, mainly through a number of data types to control hardware-related. So, roughly summarize what's included in C + +.

1, a series of understanding

C + + defines four main data types int, float, char, BOOL on the basis of the expansion of a very many data types, through new definitions or modifiers and other methods. Not mentioned here. These data types are entered into memory through the stack, stored in memory, in order to facilitate the management of this data, C + + defines a pointer, that is, the memory number of the data, in order to facilitate the search for them. In order to facilitate their conversion or to be interviewed, two symbols are specified, one is the asterisk "*", the other is the address character "&", in order to better manage resources, for some data types the same data type. C + + introduced the concept of arrays, corresponding to the array of pointers

With the above data type. They also need to make inferences about their relationships or perform operations on them, and C + + introduces operators and some operator.

Some of the molding algorithms, C + + introduced functions, as well as function parameters and return values, and so on a series of return operations, for the flexibility of C + + provides a lot of other convenience

For some specific data types. To facilitate better management, C + + joins the enumeration, struct. Classes, and of course, these types also have addresses. There are pointers, and so on, the data gathered together have some characteristics, so C + + for these composite types of data, define the public, protection, and private permissions, about the relationship between the various composite structures, public relations, friend relations and so on

In order to facilitate the transmission of some features or the transmission of features, C + + introduces inheritance and derivation, and introduces many features such as overloading in functions.

However, these are still limited to some categories, and can not be more abstract expression of programming thinking. C + + introduces virtual functions and pure virtual functions, and makes a powerful complement to the polymorphism of classes, making classes more abstract and flexible.

In order to be more detached from some data types and to be more abstract, C + + introduces templates to the class and function.

The work above is flexible enough, C + + in order to more streamline the amount of code, but also for more convenient code readability, defined the precompiled header and some macro definitions

In order to be more convenient for some operations, C + + standard library, the algorithm, the container. Io. debugging, C compatibility aspects to do a full complement

The above is the C + + language inside the entire content, in the list of categories

1: Data manipulation class: simple data. Array, pointer, operator. Operators, functions

2: Composite data: Struct and class, permissions, inheritance and derivation, polymorphic, overloaded

3: Standard: C + + standard library, precompilation and macro definition, debugging

,







Summary of C + + programming in my eyes-20150602

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.