X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=doc%2Fwebserver%2Fdeveloper-manual%2Fcoding.html;h=fead798d309e9b5ea72bf3f23ceaf6e5649f7514;hp=ca973e34198414da042d5143bed688b82c877cea;hb=72081f829de368392d04076728f8c991178c0080;hpb=701f0d2c06084708ab71fe06ded88d4b666dc826;ds=sidebyside diff --git a/doc/webserver/developer-manual/coding.html b/doc/webserver/developer-manual/coding.html index ca973e34..fead798d 100644 --- a/doc/webserver/developer-manual/coding.html +++ b/doc/webserver/developer-manual/coding.html @@ -1,11 +1,11 @@ + Coding Guidelines

4. Coding Guidelines

4. Coding Guidelines

4.1. Introduction

4.1. Introduction

This set of standards is designed to make our lives easier. It is developed with the simple goal of helping us keep the "new and improved @@ -100,13 +104,17 @@ CLASS="SECT2" >

4.2. Using Comments

4.2. Using Comments

4.2.1. Comment, Comment, Comment

4.2.1. Comment, Comment, Comment

4.2.2. Use blocks for comments

4.2.2. Use blocks for comments

4.2.3. Keep Comments on their own line

4.2.3. Keep Comments on their own line

4.2.4. Comment each logical step

4.2.4. Comment each logical step

4.2.5. Comment All Functions Thoroughly

4.2.5. Comment All Functions Thoroughly

4.2.6. Comment at the end of braces if the - content is more than one screen length

4.2.6. Comment at the end of braces if the + content is more than one screen length

4.3. Naming Conventions

4.3. Naming Conventions

4.3.1. Variable Names

4.3.1. Variable Names

4.3.2. Function Names

4.3.2. Function Names

4.3.3. Header file prototypes

4.3.3. Header file prototypes

4.3.4. Enumerations, and #defines

4.3.4. Enumerations, and #defines

4.3.5. Constants

4.3.5. Constants

4.4. Using Space

4.4. Using Space

4.4.1. Put braces on a line by themselves.

4.4.1. Put braces on a line by themselves.

4.4.2. ALL control statements should have a - block

4.4.2. ALL control statements should have a + block

4.4.3. Do not belabor/blow-up boolean - expressions

4.4.3. Do not belabor/blow-up boolean + expressions

4.4.4. Use white space freely because it is - free

4.4.4. Use white space freely because it is + free

4.4.5. Don't use white space around structure - operators

4.4.5. Don't use white space around structure + operators

4.4.6. Make the last brace of a function stand - out

4.4.6. Make the last brace of a function stand + out

4.4.7. Use 3 character indentions

4.4.7. Use 3 character indentions

4.5. Initializing

4.5. Initializing

4.5.1. Initialize all variables

4.5.1. Initialize all variables

4.6. Functions

4.6. Functions

4.6.1. Name functions that return a boolean as a - question.

4.6.1. Name functions that return a boolean as a + question.

4.6.2. Always specify a return type for a - function.

4.6.2. Always specify a return type for a + function.

4.6.3. Minimize function calls when iterating by - using variables

4.6.3. Minimize function calls when iterating by + using variables

4.6.4. Pass and Return by Const Reference

4.6.4. Pass and Return by Const Reference

4.6.5. Pass and Return by Value

4.6.5. Pass and Return by Value

4.6.6. Names of include files

4.6.6. Names of include files

4.6.7. Provide multiple inclusion - protection

4.6.7. Provide multiple inclusion + protection

4.6.8. Use `extern "C"` when appropriate

4.6.8. Use `extern "C"` when appropriate

4.6.9. Where Possible, Use Forward Struct - Declaration Instead of Includes

4.6.9. Where Possible, Use Forward Struct + Declaration Instead of Includes

4.7. General Coding Practices

4.7. General Coding Practices

4.7.1. Turn on warnings

4.7.1. Turn on warnings

4.7.2. Provide a default case for all switch - statements

4.7.2. Provide a default case for all switch + statements

4.7.3. Try to avoid falling through cases in a - switch statement.

4.7.3. Try to avoid falling through cases in a + switch statement.

4.7.4. Use 'long' or 'short' Instead of - 'int'

4.7.4. Use 'long' or 'short' Instead of + 'int'

4.7.5. Don't mix size_t and other types

4.7.5. Don't mix size_t and other types

4.7.6. Declare each variable and struct on its - own line.

4.7.6. Declare each variable and struct on its + own line.

4.7.7. Use malloc/zalloc sparingly

4.7.7. Use malloc/zalloc sparingly

4.7.8. The Programmer Who Uses 'malloc' is - Responsible for Ensuring 'free'

4.7.8. The Programmer Who Uses 'malloc' is + Responsible for Ensuring 'free'

4.7.9. Add loaders to the `file_list' structure - and in order

4.7.9. Add loaders to the `file_list' structure + and in order

4.7.10. "Uncertain" new code and/or changes to - existing code, use FIXME

4.7.10. "Uncertain" new code and/or changes to + existing code, use FIXME

4.8. Addendum: Template for files and function - comment blocks:

4.8. Addendum: Template for files and function + comment blocks:

const char FILENAME_rcs[] = "$Id: developer-manual.sgml,v 2.3 2002/09/05 02:27:59 hal9 Exp $";
+>const char FILENAME_rcs[] = "$Id: coding.html,v 1.19.2.7 2004/01/31 00:05:44 oes Exp $";
 /*********************************************************************
  *
- * File        :  $Source$
+ * File        :  $Source: /cvsroot/ijbswa/current/doc/webserver/developer-manual/coding.html,v $
  *
  * Purpose     :  (Fill me in with a good description!)
  *
@@ -2273,7 +2367,10 @@ CLASS="PROGRAMLISTING"
  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  * Revisions   :
- *    $Log$
+ *    $Log: coding.html,v $
+ *    Revision 1.19.2.7  2004/01/31 00:05:44  oes
+ *    Regenerated from sgml source
+ *
  *
  *********************************************************************/
 
@@ -2327,10 +2424,10 @@ WIDTH="100%"
 CLASS="PROGRAMLISTING"
 >#ifndef _FILENAME_H
 #define _FILENAME_H
-#define FILENAME_H_VERSION "$Id: developer-manual.sgml,v 2.3 2002/09/05 02:27:59 hal9 Exp $"
+#define FILENAME_H_VERSION "$Id: coding.html,v 1.19.2.7 2004/01/31 00:05:44 oes Exp $"
 /*********************************************************************
  *
- * File        :  $Source$
+ * File        :  $Source: /cvsroot/ijbswa/current/doc/webserver/developer-manual/coding.html,v $
  *
  * Purpose     :  (Fill me in with a good description!)
  *
@@ -2360,7 +2457,10 @@ CLASS="PROGRAMLISTING"
  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  * Revisions   :
- *    $Log$
+ *    $Log: coding.html,v $
+ *    Revision 1.19.2.7  2004/01/31 00:05:44  oes
+ *    Regenerated from sgml source
+ *
  *
  *********************************************************************/