The first enemy of C++ is its past.

During  the last few years we talk about the “C++ Renaissance”. We have to admit that Microsoft was a major actor of 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++ usage, 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 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 used for many years.

The C++ past influences a lot its using even for new created projects, and many not C++ 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 for the first link talking about shared pointers. We will be surprised by the result.

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 want 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 emiting 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.