~ubuntu-branches/ubuntu/warty/fluxbox/warty

« back to all changes in this revision

Viewing changes to doc/Coding_style

  • Committer: Bazaar Package Importer
  • Author(s): Matt Hope
  • Date: 2002-04-12 22:08:52 UTC
  • Revision ID: james.westby@ubuntu.com-20020412220852-0gbqxr57mgu63qdh
Tags: upstream-0.1.7
Import upstream version 0.1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
The coding style is almost the same as i blackbox.
 
2
Instead of 2 spaces there is tab.
 
3
Use a tab size of 2 or 4 and you will be fine.
 
4
 
 
5
if-statements:
 
6
 
 
7
        if ( stuff ) 
 
8
                function(stuff, more stuff, 
 
9
                        more, even more);
 
10
        else
 
11
                morefunction( stuff, more stuff
 
12
                        stuff, 
 
13
                        stuff,
 
14
                        stuff);
 
15
                        
 
16
if the functionline needs to be split up, like above, right after an if-statement
 
17
use {�and }, so its clear when the if-statement ends.
 
18
It should look like this
 
19
 
 
20
        if ( stuff ) {
 
21
                function(stuff, more stuff, 
 
22
                        more, even more);
 
23
        } else {
 
24
                morefunction( stuff, more stuff
 
25
                        stuff, 
 
26
                        stuff,
 
27
                        stuff);
 
28
        }
 
29
        
 
30
If a line need to be splited in an if-statement then it should use two 
 
31
tab for indent next row in if-statement like this:
 
32
 
 
33
        if ( longline && longline && longling &&
 
34
                        longline && longline && longline)
 
35
                funktion();
 
36
 
 
37
The include guards:
 
38
FILENAME_HH
 
39
 
 
40
 
 
41
Function comments:
 
42
//------------ function name --------
 
43
// This do that and that
 
44
// Returns this on success else
 
45
// this on failure.
 
46
// TODO: if there is something to do.
 
47
//-----------------------------------
 
48
type classname::function(...) {
 
49
 
 
50
}
 
51
 
 
52
 
 
53
enums must be in uppercase letters and not in file scope:
 
54
enum {WHITE, RED, BLUE};
 
55
 
 
56
Class data members are prefixed by m_ 
 
57
Class member function will be organized accordning to creator, 
 
58
manipulator and accessor categories.