In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the basic concept of C++". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Now please follow the editor's train of thought slowly and deeply. Let's study and learn what is the basic concept of C++.
First, learn about common programming languages through a new (2021.11) programming language ranking chart:
As can be seen from the picture, the ranking of C++ is not outstanding compared with Python, Java and C. the main reason is that C++ is too difficult, or it can be said that there are too many knowledge points. It is difficult to say that we can master the language of C++. We can only say that we have a partial understanding of it and can use it at work.
1. Censor + related website recommendation
1. Cppreference.com: this is the most authoritative encyclopedia of C++, but only in English. I believe you can understand it.
2. Compiler Explorer (godbolt.org): online code editing, you can directly generate assembly code, you can choose different compilers and versions, powerful
3. C++ Insights (cppinsights.io): a web page that can translate C++ code and retrograde, materializing the advanced functions of the code.
2. The relationship between C + and C
To put it simply, C++ is an extension of the C language, mainly in the following two aspects
First of all, focus on the performance aspect, which inherits from the C language:
Closely integrated with the underlying hardware
Precise control of object life cycle
Zero-overhead Abstraction
Then there is the extension part, which introduces a large number of features to facilitate engineering practice.
Three programming paradigms: process-oriented, object-oriented and generic
Function overloading, exception handling, reference
Finally, C++ is also a series of evolving standards.
Cations 98, 11, 14, 17, 20, 23?
Improvements to the language itself (e.g. Memory Model, Lambda Expressiomn)
Improvement of standard library (auto_ptr, type_train/ranges)
There are still differences in the industrial implementation of C++ standard (MSVC, GCC, Clang) and other compilers.
3.Craft + feature description
The following examples are used to illustrate the points listed above
3.1 closely integrated with the underlying hardware
If you run the cases, you can find that the number of outputs ranges from large to small.
In fact, at the bottom of the hardware, the address of storing memory is divided into big-end method and small-end method, and C++ can well adapt to different hardware storage methods, which helps to improve performance. Comparatively speaking, JAVA does not consider these, resulting in data storage in memory also need to do some processing, will increase a certain amount of time.
3.2 precise control of the life cycle of objects
Here we use C++ to compare with C#. For C#, after using an object, there is no need to pay attention to destruction, the underlying layer will be destroyed automatically (garbage collection mechanism); while C++ from the creation, use and destruction of objects need to be executed by the user, there is no need for additional system reference mechanism. There are two points that need to be balanced, that is, ease of use and performance, both of which have a certain trade-off.
Here's how C++ and C# handle exceptions:
The reason why this handling is different is caused by precise control of the life cycle. Finally is mainly used to explicitly destroy objects.
Benefits of precise control of the lifecycle: timely release of resources and no need for additional resources (threads) for garbage collection, improving performance
3.3Zero-Overhead Abstraction
It mainly includes the following two points:
You don't have to pay for unused language features.
For example, virtual functions, or constructing objects on the heap or stack, can be understood by this example: Compiler Explorer (godbolt.org)
Using some language features does not mean paying run-time costs
It can be understood by this example: Compiler Explorer (godbolt.org)
We call the function without paying the running cost of the function, which is also because the function is executed at compile time.
Thank you for your reading. the above is the content of "what is the basic concept of C++". After the study of this article, I believe you have a deeper understanding of what is the basic concept of C++. The specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.