Changes between Version 26 and Version 27 of CodeStyle
- Timestamp:
- 11/29/20 18:16:03 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodeStyle
v26 v27 20 20 * Indentation is 4 spaces, no tabs ever. 21 21 * Opening and closing brackets get their own line, and must match indentation. 22 * Line length is 80 characters .22 * Line length is 80 characters (soft limit) but may be extended up to 120 if wrapping makes the result less readable / more ugly 23 23 * C99 is allowed. E.g. `for (int i = 0; i < max; i++)`. 24 24 * Only use `/* */`-style comments … … 41 41 If you find yourself continuously exceeding the line limit, you might want to consider breaking up your function into smaller functions to reduce nesting. 42 42 43 Single lines may use up to 120 characters if the resulting code is more readable than if wrapped. But this should be an exception, no whole code blocks should be written with "more than 80 as a general norm". 44 43 45 = Some additional secure coding style rules = 44 46 45 47 This are **style rules**, ''not'' general secure coding guide lines. See e.g. https://www.securecoding.cert.org/confluence/display/c/SEI+CERT+C+Coding+Standard for useful guidelines on writing secure C. 46 48 47 == All branches shoulduse braces ==49 == All branches must use braces == 48 50 49 51 For example: … … 96 98 97 99 98 = Crustify rules =100 = Uncrustify rules = 99 101 The most fit tool for our purpose (because it can be told to just leave certain constructs alone, while changing others) seems to be 100 102