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