Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Design rule.

Sytemd specific rule.

Wrong rule.

Formatting

  • 8ch indent, no tabs, except for files in man/ which are 2ch indent, and still no tabs, and shell scripts, which are 4ch indent, and no tabs either.

  • We prefer /* comments */ over // comments in code you commit, please. This way // comments are left for developers to use for local, temporary commenting of code for debug purposes (i.e. uncommittable stuff), making such comments easily discernible from explanatory, documenting code comments (i.e. committable stuff).

  • Don’t break code lines too eagerly. We do not force line breaks at 80ch, all of today’s screens should be much larger than that. But then again, don’t overdo it, ~109ch should be enough really. The .editorconfig, .vimrc and .dir-locals.el files contained in the repository will set this limit up for you automatically, if you let them (as well as a few other things). Please note that emacs loads .dir-locals.el automatically, but vim needs to be configured to load .vimrc, see that file for instructions.

  • If you break a function declaration over multiple lines, do it like this:

    void some_function(
                    int foo,
                    bool bar,
                    char baz) {
    
            int a, b, c;
    
  • Try to write this:

    void foo() {
    }
    

    instead of this:

    void foo()
    {
    }
    
  • Single-line if blocks should not be enclosed in {}. Write this:

    if (foobar)
            waldo();
    

    instead of this:

    if (foobar) {
            waldo();
    }
    
  • Do not write foo (), write foo().

...