forked from ComparativeGenomicsToolkit/hal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCODING_STYLE.txt
67 lines (47 loc) · 1.96 KB
/
CODING_STYLE.txt
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
Please adhere to these style convetions for source code you will push (or send pull requests for) into the HAL repository. They should be pretty obvious by looking any of the existing source code...
indent: 2 spaces (no tab characters)
curly braces: on their own lines, no indent. ex:
if (x > y)
{
return true;
}
class names, struct names and other types: first character capitalized
function names and variable names: first character lower case (ex variableNameOne)
member variables: begin with _
multiword names: capitalize subsequent words (ie no underscore) (ex ClassNameOne, variableNameOne)
inline functions: not defined in class definition. ex:
class X
{
void f();
};
inline X::voidf()
{
}
maximum line width: 80 characters
never use "using namespace" in a header file
--Glenn
.emacs for the above:
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(c-add-style "mycodingstyle"
'((c-comment-only-line-offset . 0)
(c-hanging-braces-alist . ((substatement-open beforeafter)))
(c-offsets-alist . ((topmost-intro . 0)
(topmost-intro-cont . 0)
(substatement . 3)
(substatement-open . 0)
(statement-case-open . 3)
(statement-cont . 3)
(access-label . -3)
(inclass . 3)
(inline-open . 3)
(innamespace . 0)
))))
;; c/c++ mode
(add-hook 'c-mode-common-hook
'(lambda()
(c-set-style "mycodingstyle")
(setq tab-width 2)
(setq c-basic-offset tab-width)
(setq tab-width 8
;; this will make sure spaces are used instead of tabs
indent-tabs-mode nil)))