Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit 68237ec

Browse files
leodidopoiana
authored andcommitted
docs: refinements and wording in the coding conventions file
Signed-off-by: Leonardo Di Donato <[email protected]>
1 parent 28e023a commit 68237ec

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

coding_conventions.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
0 Introduction
22
------
33

4-
Sysdig strives for a consistent high quality code base and uses the conventions
4+
This repository strives for a consistent high quality code base and uses the conventions
55
below. If you are going to commit code that doesn't follow them, then you put the
6-
work on us. :-(.
6+
work on us. :-(
77

88
If you use vim or emacs, you can put a custom configuration file in the base
9-
directory of sysdig in order to follow the conventions.
9+
directory in order to follow the conventions.
1010

11-
Also, note that the conventions in this file apply **strictly to the userspace** part
12-
of sysdig. For the kernel code, you should refer to
11+
Also, note that the conventions in this file apply **strictly to the userspace** part
12+
of this repository. For the kernel code, you should refer to
1313
https://www.kernel.org/doc/html/latest/process/coding-style.html
14-
and always run checkpatch.pl from the kernel tree before submitting pull requests.
14+
and always run `checkpatch.pl` from the kernel tree before submitting pull requests.
1515

1616
Thanks for your attention and time.
1717

@@ -41,7 +41,7 @@ Example:
4141

4242
and not
4343

44-
if(a == 0)
44+
if(a == 0)
4545
b = 1;
4646

4747
3 Whitespace usage
@@ -71,7 +71,7 @@ Note that:
7171
------
7272

7373
For portability reasons, please use the standard C99 types instead of the native C types
74-
like `int` and `long`. C99 types types will be available in all the user level sysdig
74+
like `int` and `long`. C99 types types will be available in all the user level
7575
source files:
7676

7777
Example:
@@ -81,7 +81,7 @@ Example:
8181
5 Commenting Style
8282
------
8383

84-
Comments should be in the C++ style so we can use `/* */` to quickly remove
84+
Comments should be in the C++ style so we can use `/* */` to quickly remove
8585
portions of code during development.
8686

8787
Example:
@@ -160,28 +160,28 @@ Packed structures should use the GCC and MSVC-style supported `pragma`:
160160

161161
There's an online wiki which enumerates the different macros for compilers, operating systems, and architectures.
162162
It's available at [http://sourceforge.net/p/predef/wiki/Home/](http://sourceforge.net/p/predef/wiki/Home/). Generally speaking we use the operating system page: [http://sourceforge.net/p/predef/wiki/OperatingSystems/](http://sourceforge.net/p/predef/wiki/OperatingSystems/).
163-
163+
164164
12 64-bit constants
165165
-------
166166

167-
Put an "LL" at the end of your 64 bit constants. Without the LL, on some platforms the compiler tries to interpret the constant on the right hand side
167+
Put an "LL" at the end of your 64 bit constants. Without the LL, on some platforms the compiler tries to interpret the constant on the right hand side
168168
as a long integer instead of a long long and in some platform this generate an error at building time.
169169

170170
Example:
171171

172172
x=0X00FF00000000000LL
173173

174-
13 Class Declaration
174+
13 Class Declaration
175175
-------
176176

177177
Class declarations follow the following sequence
178178

179179
1. constructors and destructor
180-
1. public functions
181-
1. public data
182-
1. private functions
183-
1. private data
184-
1. friend declarations
180+
2. public functions
181+
3. public data
182+
4. private functions
183+
5. private data
184+
6. friend declarations
185185

186186
Example:
187187

@@ -191,19 +191,19 @@ Example:
191191
foo();
192192
~foo();
193193

194-
int32_t lonli();
194+
int32_t lonli();
195195
int32_t m_val;
196196

197197
private:
198-
int32_t temustra();
198+
int32_t temustra();
199199
int32_t m_val2;
200200
};
201201

202202
14 Struct guidelines
203203
-------
204204

205205
We think hiding the presence of a pointer makes the code unnecessarily
206-
ambiguous and more difficult.
206+
ambiguous and more difficult.
207207

208208
Seeing a * in a variable declaration immediately identifies a pointer, which
209209
is easier to mentally keep track of!
@@ -218,7 +218,7 @@ lives easier.
218218
typedef struct _my_struct
219219
{
220220
u_int16 m_field;
221-
} my_struct,
221+
} my_struct,
222222
*p_my_struct;
223223

224224
//
@@ -229,11 +229,11 @@ lives easier.
229229
};
230230

231231

232-
15 Temporary variables
232+
15 Temporary variables
233233
-------
234234

235-
Since "j" is used less frequently in english prose than "a" or "i", we find
236-
that these variables (in hierarchical order) are great for counters: j, k, l,
235+
Since "j" is used less frequently in english prose than "a" or "i", we find
236+
that these variables (in hierarchical order) are great for counters: j, k, l,
237237
m, n.
238238

239239
Example:
@@ -258,13 +258,13 @@ as opposed to:
258258
}
259259
}
260260

261-
16 Error management
261+
16 Error management
262262
-------
263263

264-
Error management inside libscap is done through return values, since the scap
264+
Error management inside libscap is done through return values, since the scap
265265
library is written in C.
266-
Error management in the rest of the sysdig user level code base is done through
267-
exceptions. We know there's a lot of debate between return values and
266+
Error management in the rest of the user level code base is done through
267+
exceptions. We know there's a lot of debate between return values and
268268
exceptions. We decided to pick the latter, so please stick with that.
269269

270270
## You Made It!

0 commit comments

Comments
 (0)