Support new lttng-ust error code
[lttng-tools.git] / CodingStyle
CommitLineData
0c8a2a56
MD
1LTTng-Tools Coding Style
2
ffb25bd5
DG
3Last Update: 23/07/2012
4
5C Style:
6-------------
7
8The coding style used for this project follows the the Linux kernel guide
9lines, except that brackets "{", "}" should typically be used even for
10single-line if/else statements. Please refer to:
11
12- doc/kernel-CodingStyle.txt (copied from Linux 3.4.4 git tree).
0c8a2a56 13
0c8a2a56
MD
14- Linux kernel scripts/checkpatch.pl for a script which verify the patch
15 coding style.
16
1f2f4159
DG
17Error handling:
18-------------
19
20We ask to use one single return point in a function. For that, we uses the
21"goto" statement for the error handling creating one single point for error
22handling and return code. See the following example:
23
24int some_function(...)
25{
26 int ret;
27 [...]
28
29 if (ret != 0) {
30 goto error;
31 }
32
33 [...]
34error:
35 return ret;
36}
37
ffb25bd5
DG
38Commenting:
39-------------
40
41Every function MUST have a comment above it even if the function is trivial.
42
1f2f4159
DG
43Please add non-trivial comments/documentation as much as you can in the code.
44Poor comments WILL be rejected upon merging so please pay attention to this
45details because we do!
This page took 0.024269 seconds and 4 git commands to generate.