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