Skip to content

Commit

Permalink
Add some more guidelines
Browse files Browse the repository at this point in the history
Signed-off-by: Cole Miller <[email protected]>
  • Loading branch information
cole-miller committed Feb 22, 2024
1 parent ea904a3 commit e0c5053
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ are every eight spaces.

### Braces

K&R brace style: opening braces on the same line for `if`, `for`, `while`, and
Opening braces on the same line for `struct`, `enum`, `if`, `for`, `while`, and
`do`, but on a separate line for function definitions.

`if`, `for`, `while`, and `do` always use braces, even when the body is a
Expand All @@ -38,6 +38,8 @@ single statement.

Use only `/* */` in committed code, not `//`.

Align end-of-line comments after struct field and enum variant declarations.

### Predicates

Use explicit comparisons to 0 and `NULL`: `if (int_variable == 0)` and `if
Expand All @@ -53,3 +55,7 @@ Prefer functions to function-like macros in new code.

Use defensive parentheses in the definitions of function-like macros, so that
extra parentheses are never required around the arguments at call sites.

### Functions

In function bodies, cast an argument to `void` if it is unused.

0 comments on commit e0c5053

Please sign in to comment.