Development Coding standards

All Code

Flight Code (C)

The flight side code has historically tried to stick as much as possible with the linux kernel style.

New Draft Guidelines

Always defer to K&R conventions when not explicitly covered here. Use TABS, not spaces Use typedefs only when strictly necessary - One exception is for device handles where they appear in public declarations of PiOS drivers case statements are indented at the same level as the parent switch Use spaces around parentheses for if, switch, etc., but not for functions. * Opening braces are on the same line as if, switch, etc. else is on the same line as previous closing brace, e.g.

```c
if (this_thing) {
    switch (this_thing) {
    case THING_1:
        do_some_stuff();
        break;
    case THING_2:
        do_other_stuff();
        break;
    }
} else {
    do_that_other_thing();
}
```

GCS Code (C++)

Use Qt style and Qt coding conventions