1 | |
---|
2 | |
---|
3 | |
---|
4 | 1.Coding Conventions |
---|
5 | 2.How to format your Code |
---|
6 | |
---|
7 | 1.Coding Conventions |
---|
8 | -------------------- |
---|
9 | ==> If you are beginning a new code-file: copy the proto_class.{cc,h} |
---|
10 | ==> and work with these files. |
---|
11 | |
---|
12 | a) in every code file, there has to be a GNU copyright header |
---|
13 | b) under the (c) header write your name as main-programmer, if |
---|
14 | you are just bugfixing or extending write it under co-programmer |
---|
15 | c) Every function has a header with informations about it: |
---|
16 | /** |
---|
17 | \brief <a brief description> |
---|
18 | \param <parameters the function needs> |
---|
19 | \param <more parameters> |
---|
20 | |
---|
21 | <more description> |
---|
22 | */ |
---|
23 | This makes live easier, if we want to add a documentation. |
---|
24 | |
---|
25 | |
---|
26 | 2.How to format your Code |
---|
27 | ------------------------- |
---|
28 | We use the GNU conding convention (which is also used in xemacs etc.): |
---|
29 | |
---|
30 | -- Put a space after every comma. |
---|
31 | -- Put a space before the parenthesis that begins a function call, |
---|
32 | macro call, function declaration or definition, or control |
---|
33 | statement (if, while, switch, for). (DO NOT do this for macro |
---|
34 | definitions; this is invalid preprocessor syntax.) |
---|
35 | -- The brace that begins a control statement (if, while, for, switch, |
---|
36 | do) or a function definition should go on a line by itself. |
---|
37 | -- In function definitions, put the return type and all other |
---|
38 | qualifiers on a line before the function name. Thus, the function |
---|
39 | name is always at the beginning of a line. |
---|
40 | -- Indentation level is two spaces. (However, the first and following |
---|
41 | statements of a while/for/if/etc. block are indented four spaces |
---|
42 | from the while/for/if keyword. The opening and closing braces are |
---|
43 | indented two spaces.) |
---|
44 | -- Variable and function names should be all lowercase, with underscores |
---|
45 | separating words, except for a prefixing tag, which may be in |
---|
46 | uppercase. Do not use the mixed-case convention (e.g. |
---|
47 | SetVariableToValue ()) and *especially* do not use Microsoft |
---|
48 | Hungarian notation (char **rgszRedundantTag). |
---|
49 | -- preprocessor and enum constants should be all uppercase, and should |
---|
50 | be prefixed with a tag that groups related constants together. |
---|
51 | |
---|
52 | |
---|