.. _coding_conventions: ****************** Coding Conventions ****************** Code Style ********** Formatting ========== For C++ always use tab indentation. In case of line break white spaces have to be used to fill the space. The recommended tab width is 4 characters. .. code-block:: c++ // Tabs are visualized with '>' and spaces with '.' int myFunction() { > int a = 5; > if ( a > 5 ) { > > SEISCOMP_DEBUG("A is greater than 5. Its current value is %d", > > ...............a); > return a; } C++ code is (or should be) written with the following code style: .. code-block:: c++ /*************************************************************************** * Copyright (C) by GFZ Potsdam * * * * You can redistribute and/or modify this program under the * * terms of the SeisComP Public License. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * SeisComP Public License for more details. * ***************************************************************************/ #ifndef __NAMESPACE_LIB_FILENAME_H__ #define __NAMESPACE_LIB_FILENAME_H__ #include class Complex { public: Complex(double re, double im) : _re(re), _im(im) {} double modulus() const { return sqrt(_re * _re + _im * _im); }