FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nbd/CodingStyle at master · NetworkBlockDevice/nbd · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
NetworkBlockDevice
/
nbd
Public
Notifications
You must be signed in to change notification settings
Fork
135
Star
537
Code
Issues
19
Pull requests
5
Actions
Projects
Security and quality
2
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nbd
/
CodingStyle
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (36 loc) · 1.58 KB
Breadcrumbs
nbd
/
CodingStyle
Copy path
File metadata and controls
46 lines (36 loc) · 1.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
NBD Coding style.
=================
The following expresses my opinion of what C code should look like. I'm
not as strict as the Kernel maintainers on this one (NBD isn't even
remotely as large anyway), but code that does not follow these rules
needs to be updated so that it does, which is useless time wasted for
me. Therefore, it's appreciated if you would follow these rules.
Thanks.
* Use a tab width of 8 characters. You may use tab or 8 spaces as you
please, it doesn't really matter to me.
* opening curly brackets occur on the same line as whatever they're
curly brackets for, _in all cases_. This includes function
definitions, if structures, loops, and so on; every code block appears
like so:
int foo(int bar) {
...
}
* Variable declarations are separated from the rest of a function block
by a line of whitespace. It's okay to assign a value to a variable
when you're declaring it if you can do that on one line of code, but
it must still be in the block of declarations at the top with a
whiteline below.
* Variables are declared one on each line. So no
int foo, bar;
use
int foo;
int bar;
instead.
* Try to fit everything in 80 columns. This goes especially for comment
lines, but may be relaxed for function calls with 79 arguments, or so,
if that's not feasible.
* If your function block is more than three or so screenfulls, there's a
hint that you should break it up.
It is true that not all of the code currently follows these rules; but
that should not stop you from following them for new code, or from
cleaning up if you can (i.e., you have commit rights).
Back
|
FazBrowse Home
|
New Git URL