Skip to content

Code guidelines

Oleksiy Yakovenko edited this page Nov 12, 2023 · 4 revisions

The root folder of Deadbeef sources (git) contains .clang-format configuration file, which should help to format the code to the common style.

You can apply it to individual file by running the command clang-format -style=file -i file.c

Aside of that, please try to follow the following principles:

  • Follow the existing style of a file as much as possible
  • 4 spaces for indentation (mandatory)
  • Prefer the opening { on the same line, e.g. void my_function (void) {
  • Use (void) instead of empty argument list
  • Space before ( is better than no space, including functions, e.g. int main (void)
  • Don't do this ( void )
  • Align pointer asterisks to the right, e.g. int *value;
  • Avoid trailing line-breaks and trailing spaces