summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-05-08 12:34:12 +0700
committerhathach <[email protected]>2013-05-08 12:34:12 +0700
commit1536bee8cbff6c3185b2541d61e544a030b09233 (patch)
tree48fc2098e9a9d5b3a9fc009f78bff0a43d464aec
parent2bbb9f2c6b3aec03b47a2c38c8f2d5bd078143d7 (diff)
document
-rw-r--r--readme.md31
1 files changed, 20 insertions, 11 deletions
diff --git a/readme.md b/readme.md
index e33e7f6db..ce0829c66 100644
--- a/readme.md
+++ b/readme.md
@@ -79,18 +79,27 @@ MISRA-C is well respected & a bar for industrial coding standard.
is a small & easy to remember but yet powerful coding guideline. Most (if not all) of the rules here are included in JPL. Because it is very small, all the rules will be listed here, those with bold is compliant, italic is violated.
-1. **Restrict to simple control flow constructs:** yes, I hate goto statement, therefore there is none of those here
-2. **Give all loops a fixed upper-bound:** one of my favorite rule
-3. **Do not use dynamic memory allocation after initialization:**
+1. **`Restrict to simple control flow constructs`** yes, I hate goto statement, therefore there is none of those here
+
+2. **`Give all loops a fixed upper-bound`** one of my favorite rule
+
+3. **`Do not use dynamic memory allocation after initialization`**
the tinyusb uses the static memory for all of its data.
-4. *Limit functions to no more than 60 lines of text:* 60 is a little bit too strict, I will update the relaxing number later
-5. **Use minimally two assertions per function on average:** not sure the exact number, but I use a tons of those assert
-6. **Declare data objects at the smallest possible level of scope:** one of the best & easiest rule to follow
-7. **Check the return value of non-void functions, and check the validity of function parameters:** I did check all of the public application API's parameters. For internal API, calling function needs to trust their caller to reduce duplicated check.
-8. `Limit the use of the preprocessor to file inclusion and simple macros` Although I prefer inline function, however C macros are far powerful than that. I simply cannot hold myself to use, for example X-Macro technique to simplify code.
-9. **Limit the use of pointers. Use no more than two levels of dereferencing per expression:** never intend to get in trouble with complex pointer dereferencing.
-10. **Compile with all warnings enabled, and use one or more source code analyzers:** I try to use all the defensive option of gnu, let me know if I miss some.
-> -pedantic -Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wpadded -Wnested-externs -Wredundant-decls -Winline -Wpacked
+
+4. *`Limit functions to no more than 60 lines of text`* 60 is a little bit too strict, I will update the relaxing number later
+
+5. **`Use minimally two assertions per function on average`** not sure the exact number, but I use a tons of those assert
+
+6. **`Declare data objects at the smallest possible level of scope`** one of the best & easiest rule to follow
+
+7. **`Check the return value of non-void functions, and check the validity of function parameters`** I did check all of the public application API's parameters. For internal API, calling function needs to trust their caller to reduce duplicated check.
+
+8. *`Limit the use of the preprocessor to file inclusion and simple macros`* Although I prefer inline function, however C macros are far powerful than that. I simply cannot hold myself to use, for example X-Macro technique to simplify code.
+
+9. **`Limit the use of pointers. Use no more than two levels of dereferencing per expression`** never intend to get in trouble with complex pointer dereferencing.
+
+10. **`Compile with all warnings enabled, and use one or more source code analyzers`** I try to use all the defensive option of gnu, let me know if I miss some.
+>-pedantic -Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wpadded -Wnested-externs -Wredundant-decls -Winline -Wpacked
### JPL ###