1libcaca-style(3caca) libcaca libcaca-style(3caca)
2
3
4
6 libcaca-style - Libcaca coding style
7
8
10 A pretty safe rule of thumb is: look at what has already been done and
11 try to do the same.
12
13 · Tabulations should be avoided and replaced with eight spaces.
14
15 · Indentation is generally 4 spaces.
16
17 · Lines should wrap at most at 79 characters.
18
19 · Do not leave whitespace at the end of lines.
20
21 · Do not use multiple spaces for anything else than indentation.
22
23 · Code qui fait des warnings == code de porc == deux baffes dans ta
24 gueule
25
27 Try to use short names whenever possible (i for indices, w for width,
28 cv for canvas...). Macros are always uppercase, variable and function
29 names are always lowercase. Use the underscore to separate words within
30 names:
31
32 #define BROKEN 0
33 #define MAX(x, y) ((x > y) ? (x) : (y))
34
35 unsigned int x, y, w, h;
36 char *font_name;
37 void frobulate_every_three_seconds(void);
38
39 const is a suffix. It's char const *foo, not const char *foo.
40
41 Use spaces after commas and between operators. Do not use spaces after
42 an opening parenthesis or before a closing one:
43
44 a += 2;
45 b = (a * (c + d));
46 x = min(x1, x2, x3);
47
48 Do not put a space between functions and the corresponding opening
49 parenthesis:
50
51 int function(int);
52
53 A space can be inserted after keywords such as for, while or if, but
54 consistency with the rest of the page is encouraged:
55
56 if(a == b)
57 return;
58
59 if (p == NULL)
60
61 Do not put parentheses around return values:
62
63 return a + (b & x) + d[10];
64
65 Opening braces should be on a line of their own, aligned with the
66 current block. Braces are optional for one-liners:
67
68 int function(int a)
69 {
70 if(a & 0x84)
71 return a;
72
73 if(a < 0)
74 {
75 return -a;
76 }
77 else
78 {
79 a /= 2;
80
81 switch(a)
82 {
83 case 0:
84 case 1:
85 return -1;
86 break;
87 default:
88 return a;
89 }
90 }
91 }
92
94 Nothing here yet.
95
96
97
98Version 0.99.beta19 Fri Aug 21 2020 libcaca-style(3caca)