The wind of change

published at 27.11.2015 17:09 by Jens Weller

As Twitter finally has now the option to do polls with 4 options, I asked yesterday:

Thursday Survey, which C++ Standard do you use (mostly) at work? #cpp #cplusplus — Meeting C++ (@meetingcpp) 26. November 2015

I expected some lead for C++11, and the result is surely biased toward the newer standards. But it is a surprise for me, that only 26% seem to work mostly on a pre C++11 code base. This is good, and shows how things are changing in C++ Land. And I quickly want to focus exactly on that change.

While it is nice to see that so many programmers are already able to use the newer C++ Standards, it is also true, that the situation today is a different one, then when C++11 came out. To quote myself from a few years ago:

Da es seit letztem Jahr einen neuen C++ Standard gibt, ein paar Worte hier zu. Es gibt nicht sehr häufig einen neuen C++ Standard, C++ ist eine Sprache, welche immer einen festen Kern hatte, und sich nicht auch als Framework verstand. Mit C++98 gab es den bisher verbindlichen C++ Standard, welcher dann auch in vielen Compilern umgesetzt wurde. In 2003 wurde dieser dann nochmals durch eine Ergänzung aktualisiert. Nach 2003 begannen die Vorbereitungen für den Nachfolgestandard, welcher zu nächst unter dem Arbeitstitel C++0x bekannt wurde. Man ging damals davon aus, das der Standard noch vor 2010 erscheinen würde, die Arbeiten verzögerten sich aber, so das der ISO Standard erst 2011 final wurde. Weshalb der "aktuelle" C++ Standard auch als C++11 bekannt ist.

This is around 2011/2012, and shows my own expectations towards the new standard, mostly from the viewpoint of a C++ consultant. It does not have any expectation of a C++14, or 17, its more or less, well, we'll get a new standard. But it'll be years till the compilers get updated and for now its nice to know that we can use it in a few years...

Its an honest viewpoint from seeing no big changes in the language, since I started using C++ in '98. Yet, how much has this situation changed now. Through the fast adaption of GCC and clang C++11 has become much more quickly available to a lot of C++ users, and also Microsoft makes huge efforts to compete with them. There are features for C++17, which in fact are already supported by Visual Studio 2015, and are an active contribution to the C++ standard from Microsoft.

With the release of Visual Studio 2015 I started to notice a trend this year: libraries are moving in their next major version to C++11. This is true for both encryption libraries, botan and cryptopp, both very conservative in this I believe. Of course, boost and other libraries will be around to give support for legacy C++, but newer boost libraries often also only target C++11 and beyond.

Especially those using heavily templated code will want to move to C++11 and variadic templates, and if its just for the sake of compilation speed.

Adapt or die?

So, what does this change mean for your code base?

What does it mean for your legacy code?

What does this mean for your career?

First, it is a valid move to stay behind and do maintenance on legacy code. Not all code bases will be able to move forward, and people will be needed to keep them up to date. If you don't want to this, then you should see that you stay up to date on the changes in the standards, and try to understand how you can apply those to your own problems and challenges in your code base.

When you are the owner of a code base, the situation is a bit different. Do you really want to tell people in job interviews for your team "our code base is a living fossil"?

Will critical updates for your dependencies still be available for the old toolsets you are currently based on?

Do you have the manpower to backport those patches?

Will clients still accept a product build with ancient compilers and dependencies?

So, as an owner of a code base, you should see, that adaption to newer standards and tools brings many benefits. And you should realize, that change is now a constant thing in C++ land, don't think you can run your code base on the same standard for the next 10 years, even be it C++11. You don't need to be an early adopter, but neither should you be left behind, when the landscape changes.

So be aware, that as software eats and changes the world, also will change the way we write and think about the code that will power the future.

Join the Meeting C++ patreon community!

This and other posts on Meeting C++ are enabled by my supporters on patreon!