rusefi_documentation/Code-Style.md

757 B

Code Style Guidelines

  • Reduce visibility where possible

  • Avoid magic constants

  • Please do not push dead code

We make with -std=c++11 see the Makefile

Brackets

Only the simplest, two-line if/for/while should not have the curly brackets. Anything more than two lines should have {}.

if (plain_condition)
   oneLineStatement();

if (plain_condition) {
   // comment
   oneLineStatement();
}

if (plain_condition) {
   oneLineStatement();
} else {
   oneLineStatement2();
}

Code Formatting

Code formatting matters. The de-facto standard is Eclipse CDT (K&R) with one change: Maximum line width = 120

This standard is far from perfect, but it's good enough for now.