Before the initial standardization in 1998, C++ was developed by Bjarne Stroustrup at Bell Labs since 1979, as an extension of the C language as he wanted an efficient and flexible language similar to C
In 1983, “C with Classes” was renamed to “C++”, adding new features that included virtual functions, function name and operator overloading, references, constants, type-safe free-store memory allocation (new/delete), improved type checking.
The 90s was the golden age of C++, it was very popular and many projects were developed with it especially after the OOP revolution. But after 1998 C++ was stagnated for many years. And between 2000 and 2010 no big companies supported the evolution of the language. Microsoft supported more their new .Net technology.
Surprisingly after 2010, we talk about the “C++ Renaissance”. We have to admit that Microsoft was a major actor in this movement, I remember this video where Craig Symonds and Mohsen Agsen talked about it.
In 2011 Microsoft announced in many articles the come back of C++, and Microsoft C++ experts like Herb Sutter did many conferences to explain why C++ is back and mostly recommend the use of Modern C++. In the same time, the standard C++11 was approved and we begin to talk about C++ as new language.
However, in 2011, C++ had a past of more than 30 years. And it’s not easy to convince developers that the new C++ simplified many frustrating C++ usages, and there’s a new modern way to improve the C++ Code.
Let’s take as example the memory management, which is maybe the most criticized mechanism in C++. For many years the object allocation was done by the new keyword, and the developer must never forget to invoke delete somewhere in the code. The “Modern C++” resolved this issue and promotes the use of the shared pointer.
But unfortunately, all the effort from the active C++ community and the known experts was not sufficient. Moral of the story: If you give to someone the possibility to do something with a language or a tool, don’t be surprised if he did it.
It’s what happens with C++, we still had the possibility to use new and delete, and of course, we can’t remove this possibility for many reasons. Even if the modern C++ promoted for many years the use of smart pointers. the object allocation with new will still in use for many years.
The C++ past influences a lot it using even for newly created projects, and many developers still thought that this language is very complex.
How the C++ past affects it?
To discover that, let’s do a test, just search on the web “C++ object allocation” and try to look at the results, almost all the links of the first page talk about new/delete or even malloc.
Another interesting test is to go to any university library, ask for a C++ book and read the object allocation chapter. We talk mostly about the new keyword.
To resume if a new C++ developer wants to learn it, he will find more resources about the “C with classes” instead of the modern C++.
How to prevent the big impact of the C++ past?
There’s no magic solution, we can hope that C++ compilers could help us by emitting some warnings related to the deprecated usage, like the old string manipulation (strcpy,strcat,…). But this solution will not have a big impact. The modern C++ is more new idioms to learn and practice.
Another solution will be to consider that C++ has changed its name and became “Modern C++” . Even if this solution is very simple, but its result is very interesting. And to be convinced let’s do the same search on the web as before, but this time we search for “Modern C++” object allocation, the first link will talk about smart pointers.
An advice to new C++ developers, consider that C++ was changed its name, and for all your search on the web always use “Modern C++” instead of C++, the result will be very different, using C++ will mostly give you the past practices.