1 year after launching the C++ best practices repository, the basic rules are the most popular.

Last year we launched the C++ Best Practices repository.  It’s an aggregator of some known C++ rules guides:

  • Google Style Guide.
  • jsf air vehicle c++ coding standards.
  • Effective Modern C++ from Scott Meyers.
  • POCO coding standards.

And also many rules were added by the C++ community. The goal of this repository is not to be just an aggregator of other guides. But to discover which ones are the most popular by providing the possibility to vote them. It helped us also to identify which rules we must add to our default CppDepend rules checking.

After one year here are the three most popular

mostvoted

The most popular one is basic,  and the result after applying it is very interesting. Indeed the known compilers gcc, Clang and the Microsoft compiler provide many useful diagnostics to improve your  C++ code. And even if you use the Microsoft compiler and you can compile your code base using Clang or gcc, I recommend to try doing it. You will get more useful diagnostics.

The two others rules are also basic, and every developer could apply them easilly, no need to have an advanced C++ skill to understand them like some other rules, and after applying them the code become more clean and easy to understand.

In the other side here are the less popular ones:

lessvoted

Exceptions is one of the controversy mechanism in C++, some known open source projects contributors chose to not use  them and explain why in their style guide like the case with the C++ google projects.

Maybe  the order of these rules does not reflect the C++ community choices because there are not enough votes. But what’s sure is that most developers choose always the basic rules, it’s easy to apply them and the result is generally very interesting.

To resume keep it simple and do not hesitate to apply at least the most basic best practices rules to let your code base clean and easy to maintain and understand.