tune-up C++

Tune Up Your C++ Knowledge with These Tips

By Jeff Tranter

Are you up to date with the latest C++14 and C++17 language features? Are you writing "modern C++"? Do you follow current best practices for C++? Are you avoiding deprecated language features and outdated programming practices?

C++ has evolved significantly in the last few years with the introduction of the C++11, C++14 and C++17 language standards. In my experience, a lot of Qt developers have not kept up with these new language features. That's a shame because "modern C++" (the term commonly used for C++11 and later) often leads to code that's easier to understand, better performing, and easier to maintain.

In this blog I'll present some tips and resources for upgrading your C++ programming skills and ensuring that you are following modern best practices.

Learn The New Language Features

If you aren't familiar with the features of modern C++, set aside some time for study. There are many good web sites with tutorials and reference material, and both printed and e-books for those who prefer that format. I highly recommend the book Effective Modern C++ by Scott Meyers1 for in depth coverage of how and how not to use many of the new language features.


Upgrade Your Compiler

Update your compiler version if needed. Most recent versions of compilers support C++11 and C++14. GCC 8 has complete support for C++17, as does Clang 5. Visual Studio 2017 supports almost all of C++17.

Use Static Analysis Tools


Recent releases of the Qt Creator IDE have built in support for Clang-tidy2 and Clazy3. These static analysis tools will point out areas in your code where you may be making errors or not following C++ or Qt best practices. Once set up, it is trivial to run the checks on your code and some of them can be automatically fixed from within Qt Creator.

Follow C++ Best Practices

There are a number of good resources that document the best practices for C++ programming, like this one excerpted below:


The C++ Core Guidelines4 are a collaborative effort led by Bjarne Stroustrup, the creator of C++, with the aim of helping people to use modern C++ effectively.

The Qt project itself has Coding Style5 and Coding Conventions6 documents that describe the standards to follow for the Qt framework itself. These are also a good set of standards to follow for your Qt applications if you organization does not have its own coding standard.


Google has a C++ Style Guide7 which has many good recommendations, although it currently discourages the use of C++14 and C++17 language features.


Finally, the Qt project has a set of QUIP documents (standing for Qt's Utilitarian Improvement Process and for Qt User-Submitted Improvement Proposal) that document the design processes and new features of Qt and its user community. They are maintained in git8 with an HTML version available.9



While by no means an exhaustive list, I hope some of the references described here will help you update your C++ knowledge and encourage you to use "modern C++" in your software development.


  1. Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14, Scott Meyers, 2014
  2. https://clang.llvm.org/extra/clang-tidy/
  3. https://github.com/KDE/clazy
  4. https://github.com/isocpp/CppCoreGuidelines/
  5. https://wiki.qt.io/Qt_Coding_Style
  6. https://wiki.qt.io/Coding_Conventions
  7. https://google.github.io/styleguide/cppguide.html
  8. https://code.qt.io/cgit/meta/quips.git/
  9. https://quips-qt-io.herokuapp.com/

Have a question or want to add to the conversation?

You must be logged in to continue.

Log in Register