.. _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) ... * * * * All rights reserved. * * Contact: * * * * Author: * * Email: * * * * GNU Affero General Public License Usage * * This file may be used under the terms of the GNU Affero * * Public License version 3.0 as published by the Free Software Foundation * * and appearing in the file LICENSE included in the packaging of this * * file. Please review the following information to ensure the GNU Affero * * Public License version 3.0 requirements will be met: * * https://www.gnu.org/licenses/agpl-3.0.html. * * * * Other Usage * * Alternatively, this file may be used in accordance with the terms and * * conditions contained in a signed written agreement between you and * * gempa GmbH. * ***************************************************************************/ #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); }