How to analyze the elusive language diversification of C++
How to analyze the elusive C++ language diversity problem, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
In fact, the grammar of C # is very similar to C++ language, but the errors caused by some changes are very serious. This paper makes a detailed analysis and introduction of C++ language, which is a headache for most users. It is suggested that we learn C++ as a new language.
The program code also has a style, which is nothing new. As early as the 1980s, C language programmers had to choose between the Kendr style and the ANSI style. But to be fair, I've never seen a language like C++.
It is so treacherous and elusive in terms of code style: no one can tell how many different styles C++ code can produce, but I know that there are many C++ beginners who often mistakenly think they are seeing several completely different programming languages when faced with different styles of C++ code-this alone reminds us that it is urgent to study and clarify the evolution and development of C++ language style.
Cmure with Class-inheriting the style of C language
Until December 1983, when Bjarne Stroustrup adopted Rick Mascitti's suggestion and named its new language C++, people used the term "C (C with Classes) with classes" to refer to this "dialect", which is derived from C language and has a mechanism of data abstraction.
Although C with classes is essentially an extensible language that can be converted by the preprocessor Cpre into traditional C language code (similar to the preprocessing process of the Pro*C language we see in Oracle), it did lay the stylistic foundation for all subsequent C++ code.
Class stack {char s [SIZE]; char* min; char* top; char* max; void new (); public: void push (char); char pop ();}
This "C with classes" code is recorded from the Design and Evolution of the C++ language by Stroustrup. New () in the code is actually a stack-like constructor, which is very different from the later C++ language.
It is obvious that C with classes inherits almost completely the mantle of C language in style. The declaration statements in the code look exactly the same as C language, and the structure of class is roughly similar to that of struct in C language. These signs reflect that C++ language comes from C and tries to keep compatible with C.
This design idea not only facilitates the rapid popularity of C++ (the smooth promotion of C++ language obviously benefits from the large user base that C language already has), but also deeply branded the imprint of C language in the language style of C++, so that after a few years, when C++ language has basically possessed an "independent personality", Stroustrup often has to remind people to put aside the thinking mode of C language as far as possible.
On the other hand, the object-oriented concepts borrowed by Stroustrup from the Simula language, such as class, derivation, and access control, are firmly rooted in C with classes. According to Stroustrup, his original intention of introducing object-oriented mechanisms to the C language was to find a "suitable tool".
In order to implement a distributed system or solve similar complex problems. But in any case, Stroustrup's practice of bundling the efficiency of C with the elegance of Simula has in fact planted the seeds of a "dual personality" for C++ language-it's hard to say that this is not a direct cause of C++ language style diversity.
After reading the above, have you mastered the method of how to analyze the elusive language diversity of C++? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!