Changes between Version 1 and Version 2 of CodingConventions


Ignore:
Timestamp:
Sep 9, 2006 9:29:41 PM (9 years ago)
Author:
leo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodingConventions

    v1 v2  
    33== Coding Style ==
    44
    5  * Use tabs up until the first margin, after that use spaces to have everything line up correctly with any editor settings.
     5 * Use tabs up until the first margin, after that use spaces to have everything line up correctly with any editor settings. In this example spaces are represented by '.' and tabs by '>'.
     6
     7{{{
     8#!cpp
     9if (x1 && x2)
     10{
     11> > DoStuff(param1, param2,
     12> > ........param3, param4);
     13}
     14}}}
     15
    616 * Keep braces on their own line (1 line functions can skip this rule).
     17
     18{{{
     19#!cpp
     20if (Test)
     21{
     22  x = 1;
     23}
     24else
     25{
     26  x = 2;
     27}
     28}}}
     29
     30 * Add spaces before and after math operators.
     31
     32{{{
     33#!cpp
     34int Value = x1 + x2;
     35}}}
     36
     37 * All variables and functions should be mixed case without underscores.
    738 * Function arguments should have spaces after commas, but not before/after the parenthesis.
    8  * Add spaces before and after math operators.
    9  * All variables and functions should be mixed case without underscores.
     39 * Function names should contain a verb.
     40
     41{{{
     42#!cpp
     43void lcCalculateStuff(int param1, int param2);
     44}}}
     45
    1046 * Defines and enums should be uppercase and prefixed with LC_.
     47
     48{{{
     49#!cpp
     50#define LC_EXAMPLE   1
     51
     52enum
     53{
     54  LC_TYPE1
     55  LC_TYPE2
     56};
     57}}}
     58
    1159 * Prefix class member variables with m_.
     60 * If a struct has member functions then it should be a class.
     61
     62{{{
     63#!cpp
     64class lcMyClass
     65{
     66public:
     67  m_Value;
     68}
     69
     70}}}
     71
     72
    1273 * Any code shared by all platforms should go in the common directory, platform specific code goes into the respective platform directory.
    1374 * Avoid using platform #ifdef's, if a function is different for each platform it should be in the platform directory.
     
    1879 * All binary files are always written as little endian files, even on big endian computers.
    1980 * Use the File class for reading/writing files to make sure they are endian swapped correctly.
    20  * Use the lcuint32 etc types for structures that are saved to make sure they can be loaded under different platforms.
     81 * Use the u32 etc types for structures that are saved to make sure they can be loaded under different platforms.
    2182