| Line 13: | Line 13: | ||
** one tab | ** one tab | ||
* Write comments appropriately | * Write comments appropriately | ||
| - | ** | + | ** Comments for functional block but not for code line |
| - | * | + | ** Comment lines before the described code block |
| + | ** One blank line before comment lines to separate it from other logics | ||
| + | * Maximum text width is 80 columns in a line, with very few exceptions | ||
* Deal with “()” and “{}” correctly | * Deal with “()” and “{}” correctly | ||
| + | Deal with “()” correctly | ||
| + | Add 1 blank space when with reserved word: for (), if () | ||
| + | Directly connect when with function: functionA() | ||
| + | Deal with “{}” correctly | ||
| + | Two Styles: | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Choose one and keep it, but not mix | ||
| + | |||
* Naming, naming … | * Naming, naming … | ||
| + | ** xxxx_yyyy_zzzz VS xxxxYyyyZzzz | ||
| + | ** Choose one and keep it, but not mix | ||
| + | |||
* Pre-release test | * Pre-release test | ||
| + | ** Memory Usage Check Tool: Valgrind | ||
| + | ** Static Code Check Tool: K7 | ||
| + | ** Checkpatch.pl | ||
Code style common rule
Deal with “()” correctly Add 1 blank space when with reserved word: for (), if () Directly connect when with function: functionA() Deal with “{}” correctly Two Styles:
Choose one and keep it, but not mix