File: style.dox

package info (click to toggle)
libcaca 0.99.beta20-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,512 kB
  • sloc: ansic: 25,091; php: 2,763; python: 2,637; cs: 1,213; cpp: 1,127; java: 916; objc: 836; makefile: 543; perl: 505; sh: 472; asm: 297; ruby: 215; xml: 33
file content (100 lines) | stat: -rw-r--r-- 2,136 bytes parent folder | download | duplicates (9)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/** \page libcaca-style Libcaca coding style

 \section sty1 General guidelines

 A pretty safe rule of thumb is: look at what has already been done and
 try to do the same.

 - Tabulations should be avoided and replaced with \e eight spaces.
 - Indentation is generally 4 spaces.
 - Lines should wrap at most at 79 characters.
 - Do not leave whitespace at the end of lines.
 - Do not use multiple spaces for anything else than indentation.
 - Code qui fait des warnings == code de porc == deux baffes dans ta gueule

 \section sty2 C coding style

 Try to use short names whenever possible (\c i for indices, \c w for width,
 \c cv for canvas...). Macros are always uppercase, variable and function
 names are always lowercase. Use the underscore to separate words within
 names:

 \code
#define BROKEN 0
#define MAX(x, y) ((x > y) ? (x) : (y))

unsigned int x, y, w, h;
char *font_name;
void frobulate_every_three_seconds(void);
 \endcode

 \c const is a \e suffix. It's \c char \c const \c *foo, not \c const \c char
 \c *foo.

 Use spaces after commas and between operators. Do not use spaces after an
 opening parenthesis or before a closing one:

 \code
a += 2;
b = (a * (c + d));
x = min(x1, x2, x3);
 \endcode

 Do not put a space between functions and the corresponding opening
 parenthesis:

 \code
int function(int);
 \endcode

 A space can be inserted after keywords such as \c for, \c while or \c if,
 but consistency with the rest of the page is encouraged:

 \code
if(a == b)
    return;

if (p == NULL)
 \endcode

 Do not put parentheses around return values:

 \code
return a + (b & x) + d[10];
 \endcode

 Opening braces should be on a line of their own, aligned with the
 current block. Braces are optional for one-liners:

 \code
int function(int a)
{
    if(a & 0x84)
        return a;

    if(a < 0)
    {
        return -a;
    }
    else
    {
        a /= 2;

        switch(a)
        {
            case 0:
            case 1:
                return -1;
                break;
            default:
                return a;
        }
    }
}
 \endcode

 \section sty3 C++ coding style

 Nothing here yet.

*/