Skip to content

Commit 68a3daa

Browse files
authored
Merge pull request betaflight#7311 from mikeller/update_enum_documentation
Added rule for trailing comma in enums. Agreed.
2 parents f85463b + 3466923 commit 68a3daa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/development/CodingStyle.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ and no space around the '.' and "->" structure member operators.
108108
'*' and '&', when used for pointer and reference, shall have no space between it and the following variable name.
109109

110110
# typedef
111+
enums that do not have a count or some other form of terminator element shall have a comma after their last element:
112+
113+
```
114+
typedef enum {
115+
MSP_RESULT_ACK = 1,
116+
MSP_RESULT_ERROR = -1,
117+
MSP_RESULT_NO_REPLY = 0,
118+
MSP_RESULT_CMD_UNKNOWN = -2,
119+
} mspResult_e;
120+
```
121+
122+
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.
123+
111124
enums with a count should have that count declared as the last item in the enumeration list,
112125
so that it is automatically maintained, e.g.:
113126
```

0 commit comments

Comments
 (0)