pgdir_walk, boot_map_segment, page_{lookup,remove,insert} implemented.
[mit-jos.git] / CODING
blob55d11d73417fb5aed74e4691694bc936f1ea7baf
1 JOS CODING STANDARDS
3 It's easier on everyone if all authors working on a shared
4 code base are consistent in the way they write their programs.
5 We have the following conventions in our code:
7 * No space after the name of a function in a call
8   For example, printf("hello") not printf ("hello").
10 * One space after keywords "if", "for", "while", "switch".
11   For example, if (x) not if(x).
13 * Space before braces.
14   For example, if (x) { not if (x){.
16 * Function names are all lower-case separated by underscores.
18 * Beginning-of-line indentation via tabs, not spaces.
20 * Preprocessor macros are always UPPERCASE.
21   There are a few grandfathered exceptions: assert, panic,
22   static_assert, offsetof.
24 * Pointer types have spaces: (uint16_t *) not (uint16_t*).
26 * Multi-word names are lower_case_with_underscores.
28 * Comments in imported code are usually C /* ... */ comments.
29   Comments in new code are C++ style //.
31 * In a function definition, the function name starts a new line.
32   Then you can grep -n '^foo' */*.c to find the definition of foo.
34 * Functions that take no arguments are declared f(void) not f().