STYLE: added 10 rules reference
This commit is contained in:
		
							parent
							
								
									22bb26b9cb
								
							
						
					
					
						commit
						f7ebe7cf57
					
				
							
								
								
									
										25
									
								
								STYLE
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								STYLE
									
									
									
									
									
								
							@ -84,8 +84,33 @@ library crates. Group alike statements:
 | 
			
		||||
	use strerror::StrError;
 | 
			
		||||
	use sysexits::{ EX_OSERR, EX_USAGE };
 | 
			
		||||
 | 
			
		||||
11. Do not use do while loops in C.
 | 
			
		||||
 | 
			
		||||
12. Follow the 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.
 | 
			
		||||
	3. Avoid heap memory allocation.
 | 
			
		||||
	4. Restrict functions to a single printed page.
 | 
			
		||||
	5. Use a minimum of two runtime assertions per function.
 | 
			
		||||
	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.
 | 
			
		||||
	8. Use the preprocessor sparingly.
 | 
			
		||||
	9. Limit pointer use to a single dereference, and do not use function
 | 
			
		||||
	pointers.
 | 
			
		||||
	10. Compile with all possible warnings active; all warnings should then be
 | 
			
		||||
	addressed before release of the software.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
References
 | 
			
		||||
==========
 | 
			
		||||
 | 
			
		||||
[0] <https://web.eecs.umich.edu/~imarkov/10rules.pdf>
 | 
			
		||||
 | 
			
		||||
--
 | 
			
		||||
Copyright © 2024 Emma Tebibyte <emma@tebibyte.media>
 | 
			
		||||
Copyright © Wikipedia contributors
 | 
			
		||||
 | 
			
		||||
This work is licensed under CC BY-SA 4.0. To view a copy of this license, visit
 | 
			
		||||
<http://creativecommons.org/licenses/by-sa/4.0/>.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user