My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
==========================
NEPTUNER Coding Guidelines
- sonofdelphi
2009-12-13
2008-12-16
==========================

* To enable faster coding with an IDE
* To enable better debugging, no guessing what a variable is!

Variable naming
================

Variables are named as:
<Scope><Indirection><Aggregation><Usage><NameInTitleCase>

Scope Modifier
* Member variables start with m_
* Global variables start with g_
* Function Parameters start with "in_"
* Local variables don't have a scope modifier

Indirection Modifier
* Pointer variables start with p
* Reference variables start with r
* Other variables don't have an indirection modifier

Aggregation Modifier
* a - aggregates (arrays, vectors, lists etc)
* Plain variables don't have an aggregation modifier

Usage Modifier
* n - used for counting
* s - used as string
* c - character
* b - used as boolean
* f - used as a function. Deprecated though.
* e - enumeration types
* x - other structs, x = Complex = non-simple
* Other types (what are they?:-) don't have a usage modifier.

Indentation
=============
* Use a single indent for every {} block.

* { and } should be on new lines, at the same indentation level as the conditional.
Eg:
if(someCondition)
{
statement1;
statement2;
}

* Single line conditionals need not have {} marking.
But make sure you indent the single statement.

Type naming
=============
* Follow TitleCasing for user-defined types - classes, structs, enums.
Eg:
class Student
{
string m_sName;
int m_nMarks;
};

Function naming
================
* Functions should follow camelCase.
* The first word of a function should be a verb.
Eg: doSomeThing()

Pseudoclass functions
======================
* For C-style module functions, name as ModuleName_<camelCaseFunctionName>
Eg: Neptuner_addStuff

Change log

r386 by sonofdelphi on Jan 26, 2010   Diff
dos2unix lineendings
Go to: 
Sign in to write a code review

Older revisions

r378 by sonofdelphi on Dec 20, 2009   Diff
syncing trunk with 0.2
r181 by sonofdelphi on Oct 10, 2009   Diff
release documentation
r161 by sonofdelphi on Oct 9, 2009   Diff
talk is cheap
All revisions of this file

File info

Size: 1790 bytes, 77 lines
Powered by Google Project Hosting