X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=CodingStyle;h=77fa90c733be38f090d937d05950ffc47ef29122;hp=180d097994a450e512d9ec218fc22c7fe8f67c0d;hb=a98dae5fe5dc81dcf7e5146d3d6915dd6b3d055a;hpb=0c8a2a56138dc1e31e7cfa359cfc00f89f331fb7 diff --git a/CodingStyle b/CodingStyle index 180d09799..77fa90c73 100644 --- a/CodingStyle +++ b/CodingStyle @@ -1,11 +1,45 @@ LTTng-Tools Coding Style -The coding style used for this project follows the the Linux kernel -guide lines, except that brackets "{", "}" should typically be used even -for single-line if/else statements. Please refer to: +Last Update: 23/07/2012 + +C Style: +------------- + +The coding style used for this project follows the the Linux kernel guide +lines, except that brackets "{", "}" should typically be used even for +single-line if/else statements. Please refer to: + +- doc/kernel-CodingStyle.txt (copied from Linux 3.4.4 git tree). -- Linux kernel Documentation/CodingStyle document for details, - Linux kernel scripts/checkpatch.pl for a script which verify the patch coding style. -Mathieu Desnoyers, May 30, 2012 +Error handling: +------------- + +We ask to use one single return point in a function. For that, we uses the +"goto" statement for the error handling creating one single point for error +handling and return code. See the following example: + +int some_function(...) +{ + int ret; + [...] + + if (ret != 0) { + goto error; + } + + [...] +error: + return ret; +} + +Commenting: +------------- + +Every function MUST have a comment above it even if the function is trivial. + +Please add non-trivial comments/documentation as much as you can in the code. +Poor comments WILL be rejected upon merging so please pay attention to this +details because we do!