Impala C++ Code follows a modified version of the Google C++ Style Guide at:
There are some key differences which are documented here.
- Separate inline headers: We allow putting inline functions in separate files, using the suffix
.inline.h. This can speed up compile times by reducing the volume of code to be compiled and reducing dependencies between headers.
- namespaces the
using namespacedirective is allowed in .cc files in limited cases where it greatly reduces code volume.
- Pros: reduces code volume, less churn in "using namespace::class" directives.
- Cons: pollutes the namespace, causes conflicts, makes it more difficult to determine the type of an object
- TODO Comments we do not include the name in the TODO comment
The .clang-format file checked into the Impala repository should be used to format whitespace (see Contributing to Impala for more info). The .clang-format file is the source of truth for whitespace formatting, except when its output significantly diverges from practices in the existing codebase or from common sense. In those cases .clang-format should be updated. We aim to gradually adapt the codebase to the output of clang-format Therefore we only recommend using it on lines that have non-whitespace changes. This can be accomplished with the git-clang-format tool.
Some key differences from the Google C++ style are:
- Line Length We use 90 character line lengths
- Function Declaration we line wrap differently than Google, typically packing more parameters per line, e.g.:
3. Conditionals we format conditionals as follows
- Boost - we use a different set of Boost libraries. Reducing # of dependencies is encouraged and adding dependencies to new libraries should be carefully evaluated.
You can check that your code is tidy with clang-tidy: