File: style.dox

package info (click to toggle)
libcaca 0.99.beta14-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 6,720 kB
  • ctags: 2,334
  • sloc: ansic: 18,652; cs: 1,171; objc: 835; cpp: 741; makefile: 446; sh: 289; python: 215; ruby: 190; asm: 93
file content (95 lines) | stat: -rw-r--r-- 1,981 bytes parent folder | download
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
/* $Id$ */

/** \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);

if(a == b)
    return;
 \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.

*/