Changes between Version 5 and Version 6 of Coding_Conventions


Ignore:
Timestamp:
2010-07-22 21:45:50 (3 years ago)
Author:
V0idExp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Coding_Conventions

    v5 v6  
    1111 * All source files (.cpp, .h) must start with the following header, before any other content: 
    1212{{{ 
    13 /* Copyright (C) 2009 Wildfire Games. 
     13/* Copyright (C) 2010 Wildfire Games. 
    1414 * This file is part of 0 A.D. 
    1515 * 
     
    2828 */ 
    2929}}} 
    30 replacing `2009` with the year that the file was last updated. 
     30replacing `2010` with the year that the file was last updated. 
    3131 
    3232 * Wrap header files in include guards, using the name `INCLUDED_`''filename'', e.g. the file `Foo.h` should say: 
     
    6161 * Class names are !CamelCase and prefixed with `C`, e.g. `CGameObject`. Member functions are !CamelCase, e.g. `CGameObject::SetModifiedFlag(...)`. Member variables are !CamelCase prefixed with `m_`, e.g. `CGameObject::m_ModifiedFlag`. Files are named `GameObject.cpp`, `GameObject.h`, usually with one major class per file (possibly with some other support classes in the same files). 
    6262 
    63  * Use [http://www.cppdoc.com/ CppDoc] comments, e.g. 
     63 * Use [http://www.doxygen.org/ Doxygen] comments, e.g. 
    6464{{{ 
    6565class CExampleObject 
     
    205205    * 
    206206    * (Notes regarding usage and possible problems etc...) 
    207     **/ 
    208 }}} 
    209 For single-line comments, `///` can be used as well. The comment text is inserted into the documentation, and can additionally be formatted by certain tags (e.g. `@param description` for function parameters). For more details, see the !CppDoc documentation. 
     207    */ 
     208}}} 
     209For single-line comments, `///` can be used as well. The comment text is inserted into the documentation, and can additionally be formatted by certain tags (e.g. `@param description` for function parameters). For more details, see the !Doxygen documentation. 
    210210 
    211211Each method of a class should be documented as well and here is the suggested method of documenting a member function (continuing with `CExample`): 
     
    221221        * documenting a member function. 
    222222        * @param dummy A dummy parameter. 
    223         **/ 
     223        */ 
    224224       void ShowExample(int dummy);  
    225225    
     
    250250    * Description : CExample interface file. 
    251251    * ========================================================================= 
    252     **/ 
     252    */ 
    253253    
    254254   /* 
     
    268268    * provide an example of documenting a class. 
    269269    * Notes regarding usage and possible problems etc... 
    270     **/ 
     270    */ 
    271271   class CExample 
    272272   { 
     
    279279        * documenting a member function. 
    280280        * @param dummy A dummy parameter. 
    281         **/ 
     281        */ 
    282282       void ShowExample(int dummy);  
    283283    
     
    304304== Singletons == 
    305305 
    306 Much debate regarding the use of global variables has been generated over the years so we will not re-enter that discussion. The Singleton design pattern does provide many benefits over that of a pure global variable. 
    307  
    308 We will make use of the Automatic Singleton Utility as described by Scott Bilas in article 1.3 of the "Game Programming Gems", volume I, "An Automatic Singleton Utility". 
     306After a long debate, it was decided to not use Singletons and to prefer global variables to them. All global variables have to be prefixed with 'g_' and their initialisation should be as clear and transparent as possible. So, if there's a class like CGame, which needs to exist in a single instance, there will be a pointer declaration called 'g_Game' in Game.h, and all initialisation details will be "hidden" in Game.cpp. There are still some Singletons in the current codebase, but they will be reimplemented and the new code should be written using globals. 
    309307 
    310308== Strings ==