Mercurial > hg
annotate mcabber/CodingStyle.txt @ 2366:480585fec48a default tip
Update spell checking section in the configuration file
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 30 May 2023 16:37:46 +0200 |
parents | ffd0e57e9563 |
children |
rev | line source |
---|---|
1509
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
1 This document describes the preferred coding style for the mcabber project. |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
2 |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
3 If you intend to patch and contribute to mcabber, please try to use the |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
4 existing style, and read the following points. |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
5 |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
6 - Do not use tabs, use space characters; |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
7 - Avoid trailing whitespace; |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
8 - Avoid lines longer than 80 characters; |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
9 - Indentation is 2 spaces (ok, maybe it isn't a good idea but it's the |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
10 current style); |
2337 | 11 - Defined types shall end with _t |
1509
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
12 - Put a space after non-functions statements (e.g. if, while...) |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
13 - Put the opening brace last on the same line, and put the closing brace first |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
14 except for functions, where the opening brace should be alone on a new line. |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
15 |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
16 Example: |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
17 |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
18 void example(void) |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
19 { |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
20 if (cond1) { |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
21 do_a(); |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
22 } else if (cond2) { |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
23 do_b(); |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
24 } else { |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
25 do_c(); |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
26 } |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
27 |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
28 if (error) |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
29 exit(0); |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
30 } |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
31 |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
32 - Look at existing code for rules not mentioned here. |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
33 |
189ffdd944b4
Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff
changeset
|
34 Mikael |