Satish B. SettyArchiveAboutRSS Feed

A dialect of C++

C++ is a vast, complex and complicated language. When hundreds of developers are working on a project, we want to limit ourselves to a subset. There are many reasons to do (or not to do) so. Primarily, it is for readability and maintainability. You must face the truth that all the people who are working in a project do not have equal skill and knowledge about C++. Some are beginners, many are intermediate and a few are advanced in C++. You have to choose a subset of C++ because, unlike C or Go, you can’t store much of the language in your head. There have been such attempts earlier, but have been shot down by C++ evangelists. I particularly liked GCC C++ guidelines

Omitted features

Limited features

Other attempts

Useful compiler flags

Some more: -Wall -Wextra -Wpedantic -Wshadow -Woverloaded-virtual -Wabi -Wcast-qual -Wcast-align -Wfloat-equal -Wmissing-declarations -Wmissing-include-dirs -Wctor-dtor-privacy -Wnon-virtual-dtor. If you don’t mind noisy output for extra caution, then -Weffc++. For even more fun, -Werror.

Even more: -fwrapv -fno-nonansi-builtins -fstack-protector -fsanitize.

Coding Style

Use astyle or clang-format with Mozilla-style. Naming style follows the convention of C++ Standard:

#include "my_class.hpp"      // corresponding to my_class.cpp
#include <vector>            // C++ Standard libraries
#include <fmtlib/posix.h>    // Headers from dependencies outside project
#include "my_project.h"      // Headers from current project