path:
/STYLE.md
1.24 KB | plain
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
# Coding Style
liveside follows the suckless coding style guidelines:
https://suckless.org/coding_style/
Use Artistic Style for routine formatting:
```sh
make format
make check-format
```
The formatter config is `.astylerc`. AStyle does not enforce every rule below
(for example, declarations at the top of blocks), so use it as the mechanical
baseline rather than a substitute for the style guide.
Project conventions:
- C99, POSIX-first.
- Define `_POSIX_C_SOURCE=200809L` for POSIX builds where practical.
- System headers first, alphabetically where include-order constraints allow.
- Local headers after a blank line.
- Tabs for indentation, spaces for alignment.
- Function return type on its own line; function name and arguments on the next line.
- Declarations at the top of blocks; do not mix declarations and statements.
- No `//` comments.
- Keep lines to a reasonable length, targeting 79 columns.
- Prefer `int` predicates over C99 `bool` for new C code.
- Do not introduce new `_t` typedef names; use CamelCase for typedef'd user types.
- Static functions and globals unless they must be exported.
Existing code may not yet be fully converted. New code should follow this style,
and touched code should move toward it without unrelated churn.