You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 19, 2024. It is now read-only.
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.
15
15
16
16
Thanks for your attention and time.
17
17
@@ -41,7 +41,7 @@ Example:
41
41
42
42
and not
43
43
44
-
if(a == 0)
44
+
if(a == 0)
45
45
b = 1;
46
46
47
47
3 Whitespace usage
@@ -71,7 +71,7 @@ Note that:
71
71
------
72
72
73
73
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
75
75
source files:
76
76
77
77
Example:
@@ -81,7 +81,7 @@ Example:
81
81
5 Commenting Style
82
82
------
83
83
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
85
85
portions of code during development.
86
86
87
87
Example:
@@ -160,28 +160,28 @@ Packed structures should use the GCC and MSVC-style supported `pragma`:
160
160
161
161
There's an online wiki which enumerates the different macros for compilers, operating systems, and architectures.
162
162
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
+
164
164
12 64-bit constants
165
165
-------
166
166
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
168
168
as a long integer instead of a long long and in some platform this generate an error at building time.
169
169
170
170
Example:
171
171
172
172
x=0X00FF00000000000LL
173
173
174
-
13 Class Declaration
174
+
13 Class Declaration
175
175
-------
176
176
177
177
Class declarations follow the following sequence
178
178
179
179
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
185
185
186
186
Example:
187
187
@@ -191,19 +191,19 @@ Example:
191
191
foo();
192
192
~foo();
193
193
194
-
int32_t lonli();
194
+
int32_t lonli();
195
195
int32_t m_val;
196
196
197
197
private:
198
-
int32_t temustra();
198
+
int32_t temustra();
199
199
int32_t m_val2;
200
200
};
201
201
202
202
14 Struct guidelines
203
203
-------
204
204
205
205
We think hiding the presence of a pointer makes the code unnecessarily
206
-
ambiguous and more difficult.
206
+
ambiguous and more difficult.
207
207
208
208
Seeing a * in a variable declaration immediately identifies a pointer, which
209
209
is easier to mentally keep track of!
@@ -218,7 +218,7 @@ lives easier.
218
218
typedef struct _my_struct
219
219
{
220
220
u_int16 m_field;
221
-
} my_struct,
221
+
} my_struct,
222
222
*p_my_struct;
223
223
224
224
//
@@ -229,11 +229,11 @@ lives easier.
229
229
};
230
230
231
231
232
-
15 Temporary variables
232
+
15 Temporary variables
233
233
-------
234
234
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,
237
237
m, n.
238
238
239
239
Example:
@@ -258,13 +258,13 @@ as opposed to:
258
258
}
259
259
}
260
260
261
-
16 Error management
261
+
16 Error management
262
262
-------
263
263
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
265
265
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
268
268
exceptions. We decided to pick the latter, so please stick with that.
0 commit comments