1 SuperTux Coding Standards
2 =========================
4 * start member variable name with "m_", global variables with "g_" and
5 static variables with "s_"
7 * proper separation between generic engine code and game specific code
8 should be done whenever feasible
10 * the path in #include directives must not contain "..", all paths
11 must be relative to the src/ directory
13 * external libraries are not allowed in src/, they go to external/
15 * do not use raw pointer and new/delete, use std::unique_ptr<> instead
17 * properly separate data members and member functions, don't mix them
18 in the same public/private/protected section
20 * conditional includes should be indented:
23 # include "foobar.hpp"
26 * use #include <> for libraries in external/
28 * include guards are of the form:
30 #ifndef HEADER_SUPERTUX_{PATH}_{FILE}_HPP
31 #define HEADER_SUPERTUX_{PATH}_{FILE}_HPP
33 * use one file per class
35 * write namespaces like: "namespace NameSpace {", no newline before the '{', finish them with:
36 "} // namespace Namespace"
38 * compile with the maximum warning level and with -Werror:
40 -Werror -ansi -pedantic -Wall -Wextra -Wnon-virtual-dtor -Weffc++
41 -Wcast-qual -Winit-self -Wno-unused-parameter
43 possible additional flags for the future: -Wconversion -Wshadow
45 * write doxygen comments as:
47 /** This is a comment */
49 do not use /**< and other styles of comments
51 * more info on good practices can be found at:
53 http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml