From d5d13b84a76a07182814bf87be92d05b9fe45cc1 Mon Sep 17 00:00:00 2001 From: emma Date: Sun, 28 Jul 2024 00:34:42 -0600 Subject: [PATCH] STYLE: repition & Kernighan quote --- STYLE | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/STYLE b/STYLE index 76ecc99..5322661 100644 --- a/STYLE +++ b/STYLE @@ -86,7 +86,7 @@ library crates. Group alike statements: 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]: 1. Avoid complex flow constructs, such as goto and recursion. 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. 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. 9. Limit pointer use to a single dereference, and do not use function pointers. @@ -103,6 +104,12 @@ Developing Safety-Critical Code [0]: addressed before release of the software (for C compilers, compile with -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 ==========