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