STYLE: repition & Kernighan quote
This commit is contained in:
parent
aed64840ea
commit
d5d13b84a7
11
STYLE
11
STYLE
@ -86,7 +86,7 @@ library crates. Group alike statements:
|
|||||||
|
|
||||||
11. Do not use do while loops in C.
|
11. Do not use do while loops in C.
|
||||||
|
|
||||||
12. Follow the following rules from the paper The Power of 10: Rules for
|
12. Adhere to the following rules from the paper The Power of 10: Rules for
|
||||||
Developing Safety-Critical Code [0]:
|
Developing Safety-Critical Code [0]:
|
||||||
1. Avoid complex flow constructs, such as goto and recursion.
|
1. Avoid complex flow constructs, such as goto and recursion.
|
||||||
2. All loops must have fixed bounds. This prevents runaway code.
|
2. All loops must have fixed bounds. This prevents runaway code.
|
||||||
@ -95,7 +95,8 @@ Developing Safety-Critical Code [0]:
|
|||||||
|
|
||||||
6. Restrict the scope of data to the smallest possible.
|
6. Restrict the scope of data to the smallest possible.
|
||||||
7. Check the return value of all non-void functions, or cast to void to
|
7. Check the return value of all non-void functions, or cast to void to
|
||||||
indicate the return value is useless.
|
indicate the return value is useless (such as in the case of using
|
||||||
|
fprintf(3p) to print to the standard error).
|
||||||
8. Use the preprocessor sparingly.
|
8. Use the preprocessor sparingly.
|
||||||
9. Limit pointer use to a single dereference, and do not use function
|
9. Limit pointer use to a single dereference, and do not use function
|
||||||
pointers.
|
pointers.
|
||||||
@ -103,6 +104,12 @@ Developing Safety-Critical Code [0]:
|
|||||||
addressed before release of the software (for C compilers, compile with
|
addressed before release of the software (for C compilers, compile with
|
||||||
-Wpedantic).
|
-Wpedantic).
|
||||||
|
|
||||||
|
13. Remember this quote from The Elements of Programming Style by Brian
|
||||||
|
Kernighan:
|
||||||
|
Everyone knows that debugging is twice as hard as writing a program in the
|
||||||
|
first place. So if you're as clever as you can be when you write it, how
|
||||||
|
will you ever debug it?
|
||||||
|
|
||||||
|
|
||||||
References
|
References
|
||||||
==========
|
==========
|
||||||
|
Loading…
Reference in New Issue
Block a user