Over the past few years, we have talked about the "renaissance of C + +". We have to admit that Microsoft is the main player in the sport, and I remember mentioning it in the video by Craig Symonds and Mohsen Agsen.
In 2011, Microsoft wrote a number of articles to announce the return of C + +, and many Microsoft experts such as Herb Sutter explained why C + + would rise again in a number of meetings, mainly because of the promotion of modern C + +. And at the same time. The recognition of the C++11 standard allowed us to re-discuss C + + as a new language.
However, by 2011, C + + has been in the history of more than 30 years. So it's not easy for developers to believe that the new C + + has simplified many of the disappointing uses of the past, but instead used a new approach that improved C + + code.
Let's take memory management for example, which is perhaps the most controversial place in C + +. Over the years, the allocation of objects has been done through the new keyword, and developers must remember to call delete somewhere in the code. "Modern C + +" solves this problem and advances the use of shared pointers.
However, the promotion of modern C + + is not enough to rely on the active C + + community and well-known experts. There is a proverb: "Habit." "When you try to introduce a language or tool to someone, he may think you have a point, but it doesn't do what you want."
This is what happens on C + +, and many of us still persist in using new and delete, and this effect lasts for many years, and many non-C + + developers have been using the language by calling complex memory allocations.
The past of C + + has affected a lot of things even from the beginning of the creation of the project, many developers still think the language is very complex.
How has the past of C + + influenced it?
To find out, let's do a test, we search for "C + + object Assignment" online, and find the first link is "How is the heap object allocated in C + +?" The only way is to use new ... ". This is amazing, and the search page is talking about shared pointers, smart pointers, and almost no articles.
Another interesting test is to go to any university library to find a book about C + +, to read the section on object assignment, and you will basically not find an introduction to "shared pointers, smart pointers."
While C + + developers want to understand them, the horse casino generally looks for resources that come from "Class C" rather than modern C + +.
How do you prevent the impact of C + + 's past?
There is no particularly effective solution here. We can expect the C + + compiler to emit some warnings about the latest updates, like string operations in the past (strcpy, strcat ... ), but this solution is not a fundamental solution. The promotion of modern C + + technology requires learning and practice.
Another solution is to rename "C + +" to "Modern C + +", a solution that is simple and interesting. Searching for "Modern C + +" on the Web, the first link talks about "smart pointers" on the topic of modern C + + object allocation we're talking about.
Therefore, in the future of C + + promotion, we can remind the new C + + developers, on the network to find information about C + +, "Modern C + +" and "C + +" will be two very different search results, the former represents the latest usage of C + +, the latter only represents the past.
Recommended Reading http://www.snstele.com/space.php?uid=5242677&do=blog&id=527982
http://www.yupoo.com/photos/summo2/93898659/
The biggest enemy of C + + is its past