Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 28 and Version 29 of code/C++_styleguide


Ignore:
Timestamp:
Jun 30, 2009, 12:08:08 AM (15 years ago)
Author:
rgrieder
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/C++_styleguide

    v28 v29  
    227227}}}
    228228
     229=== Namespaces ===
     230Names representing namespaces should be all lowercase and consist of one word.
     231{{{
     232namespace util
     233{
     234}
     235}}}
     236
    229237=== Enumerations ===
    230 Enumeration constants can be prefixed by a common type name.
    231 {{{
    232 enum Color
    233 {
    234     COLOR_RED,
    235     COLOR_GREEN,
    236     COLOR_BLUE
    237 };
    238 }}}
    239 However it is better to place an enumeration in a separate namespace. Use 'Enum' as the name of the enum.
    240 {{{
    241 namespace Colour
    242 {
    243     enum Enum
     238Enumerations should either be put in class scope or within a separate namespace beginning with a capital letter. Use 'value' as the name of the enum.
     239{{{
     240class MyClass
     241{
     242public:
     243    enum Colour
    244244    {
    245245        Red,
     
    247247        Blue
    248248    };
    249 }
    250 }}}
    251 
    252 === Namespaces ===
    253 Names representing namespaces should be all lowercase and consist of one word.
    254 {{{
    255 namespace util
    256 {
     249};
     250// Or better this way
     251namespace Colour
     252{
     253    enum value
     254    {
     255        Red,
     256        Green,
     257        Blue
     258    };
    257259}
    258260}}}