Skip to content

Commit

Permalink
Merge pull request betaflight#7311 from mikeller/update_enum_document…
Browse files Browse the repository at this point in the history
…ation

Added rule for trailing comma in enums.

Agreed.
  • Loading branch information
blckmn authored Dec 29, 2018
2 parents f85463b + 3466923 commit 68a3daa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/development/CodingStyle.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@ and no space around the '.' and "->" structure member operators.
'*' and '&', when used for pointer and reference, shall have no space between it and the following variable name.

# typedef
enums that do not have a count or some other form of terminator element shall have a comma after their last element:

```
typedef enum {
MSP_RESULT_ACK = 1,
MSP_RESULT_ERROR = -1,
MSP_RESULT_NO_REPLY = 0,
MSP_RESULT_CMD_UNKNOWN = -2,
} mspResult_e;
```

This ensures that, if more elements are added at a later stage, only the additional lines show up in the review, making it easier to review.

enums with a count should have that count declared as the last item in the enumeration list,
so that it is automatically maintained, e.g.:
```
Expand Down

0 comments on commit 68a3daa

Please sign in to comment.