-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCODING
32 lines (20 loc) · 954 Bytes
/
CODING
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
JOS CODING STANDARDS
It's easier on everyone if all authors working on a shared code base are
consistent in the way they write their programs.
We have the following conventions in our code:
* No space after the name of a function in a call
For example, printf("hello") not printf ("hello").
* One space after keywords "if", "for", "while", "switch".
For example, if (x) not if(x).
* Space before braces.
For example, if (x) { not if (x){.
* Function names are all lower-case separated by underscores.
* Maximum of 80 characters per line.
* Beginning-of-line indentation via 4 spaces, not tabs.
* Preprocessor macros are always UPPERCASE.
There are a few grandfathered exceptions: assert, panic, static_assert,
offsetof.
* Pointer types have spaces: (uint16_t *) not (uint16_t*).
* Multi-word names are lower_case_with_underscores.
* Comments are C-style (/* ... */).
* Functions that take no arguments are declared f(void) not f().