Selaa lähdekoodia

CODING: Cleanup and minor addition

Spenser Reinhardt 12 vuotta sitten
vanhempi
commit
3450c9af60
1 muutettua tiedostoa jossa 12 lisäystä ja 8 poistoa
  1. 12 8
      CODING

+ 12 - 8
CODING

@@ -19,26 +19,30 @@ Currently, the exceptions to FSF recommendations are roughly equivalent
 to GNU indent with invoked as 'indent -ts 2 -br'. Specifically, the
 to GNU indent with invoked as 'indent -ts 2 -br'. Specifically, the
 exceptions are as follows:
 exceptions are as follows:
 
 
-a) leading white space for a statement should be formatted as tabs,
+a) Leading white space for a statement should be formatted as tabs,
 with one tab for each code indentation level.
 with one tab for each code indentation level.
 
 
-b) in statement continuation lines, format whitespace up to the column
+b) Statement continuation lines should; format whitespace up to the column
 starting the statement as tabs, format the rest as spaces (this
 starting the statement as tabs, format the rest as spaces (this
 results in code that is legible regardless of tab-width setting).
 results in code that is legible regardless of tab-width setting).
 
 
-c) with the exception of the above, tabs should generally be avoided
+c) With the exception of the above, tabs should generally be avoided.
 
 
-d) when tab width is 2 spaces, line-length should not exceed 80
-characters
+d) When tab width is 2 spaces, line-length should not exceed 80
+characters.
 
 
 e) The opening brace of an if or while block is on the same line as
 e) The opening brace of an if or while block is on the same line as
 the end of the conditional expression (the '-br' option).
 the end of the conditional expression (the '-br' option).
 
 
+f) All input, whether user or application based, should be validated for size
+and type prior to further use. One such example would be using strncpy() 
+instead of strcpy() to validate that the copied object does not overflow the
+bounds of the object being copied to.
 
 
 2. Perl Language Programming
 2. Perl Language Programming
 
 
-Taken from the O'Reilly book "Programming Perl" (3rd edition, pages 604-606) with
-modifications for clarity and to cohere with C coding standards.
+Taken from the O'Reilly book "Programming Perl" (3rd edition, pages 604-606)
+with modifications for clarity and to cohere with C coding standards.
 
 
 *) Always check the return code of system calls.
 *) Always check the return code of system calls.
 
 
@@ -50,7 +54,7 @@ c) A short block may be put on one line, including braces.
 
 
 d) Never omit the semicolon.
 d) Never omit the semicolon.
 
 
-e)  Surround most operators with space.
+e) Surround most operators with space.
 
 
 	$x = 5;    # do this
 	$x = 5;    # do this
 	$y=5;      # don't do this
 	$y=5;      # don't do this