From 301fb81834a482e1b30c3b4fa5032ed80d8e7c0f Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 26 Mar 2009 23:41:48 +0100 Subject: Updated hacking guide --- docs/HACKING.txt | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/HACKING.txt b/docs/HACKING.txt index 8c9c4dcb..88d22e7e 100644 --- a/docs/HACKING.txt +++ b/docs/HACKING.txt @@ -2,6 +2,9 @@ The Mana World Hacking Guide ---------------------------- +This guide is also available at http://wiki.themanaworld.org/index.php/Hacking +including more tips about C++ programming in general. + With multiple coders working on the same source files, there needs to be a standard specifying how code is written down. Not doing so can cause quite some annoyance for certain coders and easily creates more version conflicts than @@ -54,16 +57,33 @@ necessary. { }; - For if, for and while constructs, opening parenthesis may be placed on the - same line to save space. + When there is only one statement you may leave out the braces, but don't + place the statement on the same line as the condition: - In most cases these are bad: + Good: if (condition) statement; + Bad: + if (condition) statement; +* Includes: + Source files should include their header first, to make sure the headers are + self-contained. After that follow other project includes, grouped by + directory and alphabetically ordered. System includes come last. All project + includes are done relative from the 'src' directory. + + Good (subdirectory/source.cpp): + + #include "subdirectory/header.h" + + #include "somesub/bar.h" + #include "somesub/zaro.h" + + #include + * Comments: Single line C++ style comments are indented the same as the previous line. -- cgit v1.2.3-60-g2f50