Include and link physfs properly.
[tuxanci.git] / handbook / codestyle
blob0e6a765b55b66730d998aa36c3d400d308a2a129
1 ~~~ Code style ~~~
2 - based on K&R conventions
3 - line length: 80 characters
4 - comments: /* like this */
7 %%% If statements
8 if (var <= 64) {
9         return TRUE;
10 } else if (var - vor >= 64 &&
11            var + vor <= 128) {
12         return TRUE;
13 } else {
14         return FALSE;
18 %%% Switch statement
19 /* between case blocks could be one empty line if they are enough big */
20 switch (var) {
21         case 10:
22                 return 3;
23                 break;
24         case 20:
25                 return 30;
26                 break;
27         default:
28                 return 0;
29                 break;
33 %%% Header files
34 #ifndef FOO_H
35 #define FOO_H
37 #include <foolib.h>
38 #include "bar.h"
40 #define FOO     1
41 #define BAR     2
43 typedef struct foobar_struct {
44         int foo;
45         char *bar;
46 } foobar_t;
48 typedef struct {
49         int foo;
50         char *bar;
51 } barfoo_t;
53 /* breaking lines only when longer than 80 characters or for special purposes */
54 extern foobar_t *foo_new(int faa, int fae,
55                          char *bor, char *ber);
57 #endif /* FOO_H */