coding style - noma/dm-heom GitHub Wiki

Coding Style

The coding style used in this project is similar to what you find in the STL and Boost.

A CLion coding style file is available, see CLion manual.

The most important points are:

  • names: lower case
  • indentation: smart tabs
    • tabs for block indentation
    • spaces for aligned line breaks within statements
    • allows everyone to view the code with his favoured tab width
  • spaces
    • around operators
    • before non-function declaration/call parenthesis, e.g. after for, while, if, switch, etc.
  • newline before {after declarations (i.e. for function definitions, class declarations, etc.), but not after for, while, if, switch, etc.
  • trailing _ after member variables to avoid naming conflict with accessor member functions
  • error handling
    • exceptions are the favoured means for error handling
    • library error codes should be handled locally and in case of an error converted into an exception and thrown