Skip to content

Development Coding standards

Michael Corcoran edited this page Dec 2, 2016 · 6 revisions

All Code

  • Please use Linux line-endings (LF, no CR).
  • Please try to keep diff minimal. If you really feel some re-formatting is necessary, please do it in a separate commit to ease review
  • Keep lines reasonably short (80 chars is a good guide), break statements over multiple lines where necessary
  • Use default cases in switch statements only where you really intend it, they neuter compile-time checking of missed code when new enumerations are introduced

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
  • ... more to come ...

GCS Code (C++)

Use Qt style and Qt coding conventions

  • Use 4 SPACES, not tabs
  • DON'T assume that returned pointers are non-null
  • Use dynamic UAVO relations where you can, these will (soon) be checked at compile time against UAVO definitions
Clone this wiki locally