Changes between Version 28 and Version 29 of code/C++_styleguide
- Timestamp:
- Jun 30, 2009, 12:08:08 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
code/C++_styleguide
v28 v29 227 227 }}} 228 228 229 === Namespaces === 230 Names representing namespaces should be all lowercase and consist of one word. 231 {{{ 232 namespace util 233 { 234 } 235 }}} 236 229 237 === 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 238 Enumerations 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 {{{ 240 class MyClass 241 { 242 public: 243 enum Colour 244 244 { 245 245 Red, … … 247 247 Blue 248 248 }; 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 251 namespace Colour 252 { 253 enum value 254 { 255 Red, 256 Green, 257 Blue 258 }; 257 259 } 258 260 }}}