C++ Annotated: Jan – Mar 2017

Today we are happy to share our next compilation of C++ news with you.

Subscribe to the regular C++ Annotated and be the first to get the next edition!

C++ Annotated: January – March 2017

In this edition:

C++ in 2017

The C++ ecosystem

logo-sunThis blog post about the C++ ecosystem in 2017 is worth a special mention. Written in January, it overviews nicely the main expectations and trends, and not just about the language. While C++17 is indeed the main topic for this year’s discussions (as well as the features that failed to be included and so postponed for the future), it is also about adopting new standards and libraries, and of course the community including user groups and conferences.


cpp_17As C++17 is approved, pending national body comments, there are lots of resources now where you can find the final feature list, explanatory code samples, committee meeting live threads and committee meeting trip reports. This list by Bartlomiej Filipek is quite useful as it provides code samples for each feature, lists the key compilers (GCC, Clang, MSVC) explaining the versions where the feature is supported, and links to various additional articles. It’s very detailed and includes every small change.


Toggles in functions

A tricky problem with bool-typed toggles in functions is covered by this blog post. What at first glance looks like a readability issue, can actually grow into a bug especially inside some overloaded methods. The post discusses several solutions, including one proposed by the blog author.

Clang-tidy: easy start

libclangClang-tidy is the topic of regular blog posts, lightnings and even big conferences talks, like the one recent at C++ Russia 2017. Indeed, it’s a quick and easy way to get an analysis of your code base and even apply some fixes instantly.

If you’d like to try Clang-tidy, this blog post is a good place to start. Sharing a basic example where code modernization is needed and some cases with missing override attributes, it goes through the setup instruction step by step and teaches you to run a single check, apply a fix, and analyze the whole project (taking into account all the compile flags, etc.).

Continuous integration with C and C++

The challenges of CI for C and C++ are covered in this Conan blog post. It starts by explaining the C and C++ building processes, showing how the build systems can help with the incremental build. Then it goes on to binary management questions and incremental build complexity with regards to CI. The benefits of Conan Package Manager in this area are also mentioned, including re-build logic, profound dependency management, a way to specify build order of dependencies, and so on.

Inserting elements into STL container

fluent_cppIn his blog, Fluent C++, Jonathan Boccara discusses the problem with inserting several elements into an STL container efficiently. This provides an interesting overview of std::back_inserter and std::copy. The main idea is that knowing the size of the data to be inserted can help a lot in your optimization tasks.

Refactoring principles

Arne Mertz is well-known for his Simplify C++ blog and especially his series of posts about code refactorings. This time he writes about the basic refactoring principles – sounds philosophical, but they’re very useful in practice. What are these principles? In a nutshell, go with small steps that you can compile, test and commit; select a direction from the very beginning and follow it, postponing not-related changes; and don’t be afraid to break code styles, duplicate code and do other things that you usually try to avoid, if that is really necessary as an intermediate step in your refactoring procedure.

Readable modern C++

At the end of February, Timur Doumler joined C++ Russia 2017 and the Saint-Petersburg C++ user group meetup to talk about readable code and especially readable modern C++. The talk highlighted the general principles, like naming conventions, the necessity of comments, and eliminating code redundancies. Timur also put forth his ideas on how to make C++ more readable with the latest standards (from C++11 to C++17). The meetup version of the talk was recorded and is available on YouTube (with slides). He also delivered this talk at the C++ London meetup group.


This is no rocket science but a simple example of when Concepts could be beneficial. The article starts from a very simple arithmetic code sample, eliminating the compilation issues one by one. But then, it adds Concepts and gets all of them at once. Sounds good, doesn’t it? Concepts are not coming to C++17 (they still require more work and polishing in details), but that doesn’t mean you can’t start thinking about where it makes sense to adopt them in your code base.

To Catch a CLion

catch-hand-iconCatch is a cross-platform test framework for C++. It is known for its easy setup – only a single header is required, and no external dependencies are needed. Not to mention easy-to-use test cases, which are designed as self-registering functions or methods and can be divided into sections.

While this framework is not as popular as Google Test or Boost Test, it’s seeing more and more interest from the community. Phil Nash, the author of Catch, is now working at JetBrains as a developer advocate and has already influenced integration into two (out of three) C++ tools by the vendor, ReSharper C++ and CLion. This article in the CLion blog shares some useful tricks around its integration into CLion and the use of the framework itself.

The future of the C++ job market

If you feel like discussing the C++ job market and its future, go ahead and join this thread on reddit, but first invest 5 minutes into reading this article from Bartlomiej Filipek. Why? It offers a nice summary of the areas where C++ is currently applicable and lists the language’s advantages. It also gives advice for newcomers and summarizes the results of a Twitter poll on whether the C++ job market is stable, decreasing or growing.


emboIn case you are interested in embedded development, you’ll be glad to learn about a new conference dedicated to it, entitled emBO++ and driven by Odin Holmes. This year the talks covered Standardese (so called next-generation Doxygen), clang tooling for embedded systems, profiling and many more topics. Listen first hand to Odin at CppCast, a developer who is really keen on microcontrollers. The discussion covers his general impression, an overview of the audience, and of course technical specifics around embedded development.

Compiler Explorer goes Patreon

compiler_explorerCompiler Explorer is a great online tool for seeing what your C++ code compiles down to when various compilers are used. Matt Godbolt, the author and maintainer, has now opened a Patreon page for the project, primarily to cover the hosting costs. It has also given him momentum to accelerate ongoing development, at least for now, so do check it out.



CLion_400x400_Twitter_logo_whiteCLion 2017.1 was released at the end of March with nearly full support for C++14 (now only constexpr left), nested namespaces from C++17, precompiled headers support, disassembly view in debugger in case of GDB, support for the Catch test framework. There is also experimental support for the Microsoft Visual C++ compiler, so if you are not a fan of MinGW (MinGW-w64) or Cygwin, that’s something good for you to try out in CLion.

The CLion team also announced the preliminary roadmap for 2017.2, coming later this year. The plan is to focus on bug fixing, performance improvement and polishing of the existing functionality. Check it out in CLion’s blog.

ReSharper C++

R++_400x400_Twitter_logo_whiteReSharper C++ 2017.1 brought support for Visual Studio 2017 and CMake projects, extended the list of supported postfix templates, and added some new options in formatting. It also came with lots of enhancements for inspections and code cleanup tasks. For more details see the ReSharper C++ site.

Visual Studio

vs_cppTalking about Visual Studio 2017, we should mention improvements in its code analysis, including C++ Code Guidelines checkers. Example include marking objects as const unless you are writing to them, marking objects as const if passed to a function that doesn’t modify them, and using constexpr for values that can be computed at compile time (and same for functions).

Besides, Visual Studio 2017 supports several C++ compilers to serve various needs and use cases: MSVC, Clang, and GCC.

Qt Creator

qtQt Creator 4.3 Beta was announced in late March. In terms of CMake support it now comes with CMake server, which is an alternative way to get project information (instead of parsing the generators output). It also supports different contexts for file parsing and experimental Clang-based rename refactoring.


That just about covers it for March. Talk to you later!
The C++ Team

image description