Add Jochen Voss for reporting a stray
[privoxy.git] / doc / webserver / developer-manual / coding.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Coding Guidelines</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9 REL="HOME"
10 TITLE="Privoxy Developer Manual"
11 HREF="index.html"><LINK
12 REL="PREVIOUS"
13 TITLE="Documentation Guidelines"
14 HREF="documentation.html"><LINK
15 REL="NEXT"
16 TITLE="Testing Guidelines"
17 HREF="testing.html"><LINK
18 REL="STYLESHEET"
19 TYPE="text/css"
20 HREF="../p_doc.css"><META
21 HTTP-EQUIV="Content-Type"
22 CONTENT="text/html;
23 charset=ISO-8859-1"></HEAD
24 ><BODY
25 CLASS="SECT1"
26 BGCOLOR="#EEEEEE"
27 TEXT="#000000"
28 LINK="#0000FF"
29 VLINK="#840084"
30 ALINK="#0000FF"
31 ><DIV
32 CLASS="NAVHEADER"
33 ><TABLE
34 SUMMARY="Header navigation table"
35 WIDTH="100%"
36 BORDER="0"
37 CELLPADDING="0"
38 CELLSPACING="0"
39 ><TR
40 ><TH
41 COLSPAN="3"
42 ALIGN="center"
43 >Privoxy Developer Manual</TH
44 ></TR
45 ><TR
46 ><TD
47 WIDTH="10%"
48 ALIGN="left"
49 VALIGN="bottom"
50 ><A
51 HREF="documentation.html"
52 ACCESSKEY="P"
53 >Prev</A
54 ></TD
55 ><TD
56 WIDTH="80%"
57 ALIGN="center"
58 VALIGN="bottom"
59 ></TD
60 ><TD
61 WIDTH="10%"
62 ALIGN="right"
63 VALIGN="bottom"
64 ><A
65 HREF="testing.html"
66 ACCESSKEY="N"
67 >Next</A
68 ></TD
69 ></TR
70 ></TABLE
71 ><HR
72 ALIGN="LEFT"
73 WIDTH="100%"></DIV
74 ><DIV
75 CLASS="SECT1"
76 ><H1
77 CLASS="SECT1"
78 ><A
79 NAME="CODING"
80 >4. Coding Guidelines</A
81 ></H1
82 ><DIV
83 CLASS="SECT2"
84 ><H2
85 CLASS="SECT2"
86 ><A
87 NAME="S1"
88 >4.1. Introduction</A
89 ></H2
90 ><P
91 >This set of standards is designed to make our lives easier.  It is
92     developed with the simple goal of helping us keep the "new and improved
93     <SPAN
94 CLASS="APPLICATION"
95 >Privoxy</SPAN
96 >" consistent and reliable. Thus making
97     maintenance easier and increasing chances of success of the
98     project.</P
99 ><P
100 >And that of course comes back to us as individuals. If we can
101     increase our development and product efficiencies then we can solve more
102     of the request for changes/improvements and in general feel good about
103     ourselves. ;-&#62;</P
104 ></DIV
105 ><DIV
106 CLASS="SECT2"
107 ><H2
108 CLASS="SECT2"
109 ><A
110 NAME="S2"
111 >4.2. Using Comments</A
112 ></H2
113 ><DIV
114 CLASS="SECT3"
115 ><H3
116 CLASS="SECT3"
117 ><A
118 NAME="S3"
119 >4.2.1. Comment, Comment, Comment</A
120 ></H3
121 ><P
122 ><SPAN
123 CLASS="emphasis"
124 ><I
125 CLASS="EMPHASIS"
126 >Explanation:</I
127 ></SPAN
128 ></P
129 ><P
130 >Comment as much as possible without commenting the obvious.
131     For example do not comment "variable_a is equal to variable_b".
132     Instead explain why variable_a should be equal to the variable_b.
133     Just because a person can read code does not mean they will
134     understand why or what is being done. A reader may spend a lot
135     more time figuring out what is going on when a simple comment
136     or explanation would have prevented the extra research. Please
137     help your brother IJB'ers out!</P
138 ><P
139 >The comments will also help justify the intent of the code.
140     If the comment describes something different than what the code
141     is doing then maybe a programming error is occurring.</P
142 ><P
143 ><SPAN
144 CLASS="emphasis"
145 ><I
146 CLASS="EMPHASIS"
147 >Example:</I
148 ></SPAN
149 ></P
150 ><TABLE
151 BORDER="0"
152 BGCOLOR="#E0E0E0"
153 WIDTH="100%"
154 ><TR
155 ><TD
156 ><PRE
157 CLASS="PROGRAMLISTING"
158 >/* if page size greater than 1k ... */
159 if ( page_length() &#62; 1024 )
160 {
161     ... "block" the page up ...
162 }
163
164 /* if page size is small, send it in blocks */
165 if ( page_length() &#62; 1024 )
166 {
167     ... "block" the page up ...
168 }
169
170 This demonstrates 2 cases of "what not to do".  The first is a
171 "syntax comment".  The second is a comment that does not fit what
172 is actually being done.</PRE
173 ></TD
174 ></TR
175 ></TABLE
176 ></DIV
177 ><DIV
178 CLASS="SECT3"
179 ><H3
180 CLASS="SECT3"
181 ><A
182 NAME="S4"
183 >4.2.2. Use blocks for comments</A
184 ></H3
185 ><P
186 ><SPAN
187 CLASS="emphasis"
188 ><I
189 CLASS="EMPHASIS"
190 >Explanation:</I
191 ></SPAN
192 ></P
193 ><P
194 >Comments can help or they can clutter. They help when they
195     are differentiated from the code they describe. One line
196     comments do not offer effective separation between the comment
197     and the code. Block identifiers do, by surrounding the code
198     with a clear, definable pattern.</P
199 ><P
200 ><SPAN
201 CLASS="emphasis"
202 ><I
203 CLASS="EMPHASIS"
204 >Example:</I
205 ></SPAN
206 ></P
207 ><TABLE
208 BORDER="0"
209 BGCOLOR="#E0E0E0"
210 WIDTH="100%"
211 ><TR
212 ><TD
213 ><PRE
214 CLASS="PROGRAMLISTING"
215 >/*********************************************************************
216  * This will stand out clearly in your code!
217  *********************************************************************/
218 if ( this_variable == that_variable )
219 {
220    do_something_very_important();
221 }
222
223
224 /* unfortunately, this may not */
225 if ( this_variable == that_variable )
226 {
227    do_something_very_important();
228 }
229
230
231 if ( this_variable == that_variable ) /* this may not either */
232 {
233    do_something_very_important();
234 }</PRE
235 ></TD
236 ></TR
237 ></TABLE
238 ><P
239 ><SPAN
240 CLASS="emphasis"
241 ><I
242 CLASS="EMPHASIS"
243 >Exception:</I
244 ></SPAN
245 ></P
246 ><P
247 >If you are trying to add a small logic comment and do not
248     wish to "disrupt" the flow of the code, feel free to use a 1
249     line comment which is NOT on the same line as the code.</P
250 ></DIV
251 ><DIV
252 CLASS="SECT3"
253 ><H3
254 CLASS="SECT3"
255 ><A
256 NAME="S5"
257 >4.2.3. Keep Comments on their own line</A
258 ></H3
259 ><P
260 ><SPAN
261 CLASS="emphasis"
262 ><I
263 CLASS="EMPHASIS"
264 >Explanation:</I
265 ></SPAN
266 ></P
267 ><P
268 >It goes back to the question of readability. If the comment
269     is on the same line as the code it will be harder to read than
270     the comment that is on its own line.</P
271 ><P
272 >There are three exceptions to this rule, which should be
273     violated freely and often: during the definition of variables,
274     at the end of closing braces, when used to comment
275     parameters.</P
276 ><P
277 ><SPAN
278 CLASS="emphasis"
279 ><I
280 CLASS="EMPHASIS"
281 >Example:</I
282 ></SPAN
283 ></P
284 ><TABLE
285 BORDER="0"
286 BGCOLOR="#E0E0E0"
287 WIDTH="100%"
288 ><TR
289 ><TD
290 ><PRE
291 CLASS="PROGRAMLISTING"
292 >/*********************************************************************
293  * This will stand out clearly in your code,
294  * But the second example won't.
295  *********************************************************************/
296 if ( this_variable == this_variable )
297 {
298    do_something_very_important();
299 }
300
301 if ( this_variable == this_variable ) /*can you see me?*/
302 {
303    do_something_very_important(); /*not easily*/
304 }
305
306
307 /*********************************************************************
308  * But, the encouraged exceptions:
309  *********************************************************************/
310 int urls_read     = 0;     /* # of urls read + rejected */
311 int urls_rejected = 0;     /* # of urls rejected */
312
313 if ( 1 == X )
314 {
315    do_something_very_important();
316 }
317
318
319 short do_something_very_important(
320    short firstparam,   /* represents something */
321    short nextparam     /* represents something else */ )
322 {
323    ...code here...
324
325 }   /* -END- do_something_very_important */</PRE
326 ></TD
327 ></TR
328 ></TABLE
329 ></DIV
330 ><DIV
331 CLASS="SECT3"
332 ><H3
333 CLASS="SECT3"
334 ><A
335 NAME="S6"
336 >4.2.4. Comment each logical step</A
337 ></H3
338 ><P
339 ><SPAN
340 CLASS="emphasis"
341 ><I
342 CLASS="EMPHASIS"
343 >Explanation:</I
344 ></SPAN
345 ></P
346 ><P
347 >Logical steps should be commented to help others follow the
348     intent of the written code and comments will make the code more
349     readable.</P
350 ><P
351 >If you have 25 lines of code without a comment, you should
352     probably go back into it to see where you forgot to put
353     one.</P
354 ><P
355 >Most "for", "while", "do", etc... loops _probably_ need a
356     comment. After all, these are usually major logic
357     containers.</P
358 ></DIV
359 ><DIV
360 CLASS="SECT3"
361 ><H3
362 CLASS="SECT3"
363 ><A
364 NAME="S7"
365 >4.2.5. Comment All Functions Thoroughly</A
366 ></H3
367 ><P
368 ><SPAN
369 CLASS="emphasis"
370 ><I
371 CLASS="EMPHASIS"
372 >Explanation:</I
373 ></SPAN
374 ></P
375 ><P
376 >A reader of the code should be able to look at the comments
377     just prior to the beginning of a function and discern the
378     reason for its existence and the consequences of using it. The
379     reader should not have to read through the code to determine if
380     a given function is safe for a desired use. The proper
381     information thoroughly presented at the introduction of a
382     function not only saves time for subsequent maintenance or
383     debugging, it more importantly aids in code reuse by allowing a
384     user to determine the safety and applicability of any function
385     for the problem at hand. As a result of such benefits, all
386     functions should contain the information presented in the
387     addendum section of this document.</P
388 ></DIV
389 ><DIV
390 CLASS="SECT3"
391 ><H3
392 CLASS="SECT3"
393 ><A
394 NAME="S8"
395 >4.2.6. Comment at the end of braces if the
396     content is more than one screen length</A
397 ></H3
398 ><P
399 ><SPAN
400 CLASS="emphasis"
401 ><I
402 CLASS="EMPHASIS"
403 >Explanation:</I
404 ></SPAN
405 ></P
406 ><P
407 >Each closing brace should be followed on the same line by a
408     comment that describes the origination of the brace if the
409     original brace is off of the screen, or otherwise far away from
410     the closing brace. This will simplify the debugging,
411     maintenance, and readability of the code.</P
412 ><P
413 >As a suggestion , use the following flags to make the
414     comment and its brace more readable:</P
415 ><P
416 >use following a closing brace: } /* -END- if() or while ()
417     or etc... */</P
418 ><P
419 ><SPAN
420 CLASS="emphasis"
421 ><I
422 CLASS="EMPHASIS"
423 >Example:</I
424 ></SPAN
425 ></P
426 ><TABLE
427 BORDER="0"
428 BGCOLOR="#E0E0E0"
429 WIDTH="100%"
430 ><TR
431 ><TD
432 ><PRE
433 CLASS="PROGRAMLISTING"
434 >if ( 1 == X )
435 {
436    do_something_very_important();
437    ...some long list of commands...
438 } /* -END- if x is 1 */
439
440 or:
441
442 if ( 1 == X )
443 {
444    do_something_very_important();
445    ...some long list of commands...
446 } /* -END- if ( 1 == X ) */</PRE
447 ></TD
448 ></TR
449 ></TABLE
450 ></DIV
451 ></DIV
452 ><DIV
453 CLASS="SECT2"
454 ><H2
455 CLASS="SECT2"
456 ><A
457 NAME="S9"
458 >4.3. Naming Conventions</A
459 ></H2
460 ><DIV
461 CLASS="SECT3"
462 ><H3
463 CLASS="SECT3"
464 ><A
465 NAME="S10"
466 >4.3.1. Variable Names</A
467 ></H3
468 ><P
469 ><SPAN
470 CLASS="emphasis"
471 ><I
472 CLASS="EMPHASIS"
473 >Explanation:</I
474 ></SPAN
475 ></P
476 ><P
477 >Use all lowercase, and separate words via an underscore
478     ('_'). Do not start an identifier with an underscore. (ANSI C
479     reserves these for use by the compiler and system headers.) Do
480     not use identifiers which are reserved in ANSI C++. (E.g.
481     template, class, true, false, ...). This is in case we ever
482     decide to port Privoxy to C++.</P
483 ><P
484 ><SPAN
485 CLASS="emphasis"
486 ><I
487 CLASS="EMPHASIS"
488 >Example:</I
489 ></SPAN
490 ></P
491 ><TABLE
492 BORDER="0"
493 BGCOLOR="#E0E0E0"
494 WIDTH="100%"
495 ><TR
496 ><TD
497 ><PRE
498 CLASS="PROGRAMLISTING"
499 >int ms_iis5_hack = 0;</PRE
500 ></TD
501 ></TR
502 ></TABLE
503 ><P
504 ><SPAN
505 CLASS="emphasis"
506 ><I
507 CLASS="EMPHASIS"
508 >Instead of:</I
509 ></SPAN
510 ></P
511 ><P
512 ><TABLE
513 BORDER="0"
514 BGCOLOR="#E0E0E0"
515 WIDTH="100%"
516 ><TR
517 ><TD
518 ><PRE
519 CLASS="PROGRAMLISTING"
520 >int msiis5hack = 0; int msIis5Hack = 0;</PRE
521 ></TD
522 ></TR
523 ></TABLE
524 ></P
525 ></DIV
526 ><DIV
527 CLASS="SECT3"
528 ><H3
529 CLASS="SECT3"
530 ><A
531 NAME="S11"
532 >4.3.2. Function Names</A
533 ></H3
534 ><P
535 ><SPAN
536 CLASS="emphasis"
537 ><I
538 CLASS="EMPHASIS"
539 >Explanation:</I
540 ></SPAN
541 ></P
542 ><P
543 >Use all lowercase, and separate words via an underscore
544     ('_'). Do not start an identifier with an underscore. (ANSI C
545     reserves these for use by the compiler and system headers.) Do
546     not use identifiers which are reserved in ANSI C++. (E.g.
547     template, class, true, false, ...). This is in case we ever
548     decide to port Privoxy to C++.</P
549 ><P
550 ><SPAN
551 CLASS="emphasis"
552 ><I
553 CLASS="EMPHASIS"
554 >Example:</I
555 ></SPAN
556 ></P
557 ><TABLE
558 BORDER="0"
559 BGCOLOR="#E0E0E0"
560 WIDTH="100%"
561 ><TR
562 ><TD
563 ><PRE
564 CLASS="PROGRAMLISTING"
565 >int load_some_file( struct client_state *csp )</PRE
566 ></TD
567 ></TR
568 ></TABLE
569 ><P
570 ><SPAN
571 CLASS="emphasis"
572 ><I
573 CLASS="EMPHASIS"
574 >Instead of:</I
575 ></SPAN
576 ></P
577 ><P
578 ><TABLE
579 BORDER="0"
580 BGCOLOR="#E0E0E0"
581 WIDTH="100%"
582 ><TR
583 ><TD
584 ><PRE
585 CLASS="PROGRAMLISTING"
586 >int loadsomefile( struct client_state *csp )
587 int loadSomeFile( struct client_state *csp )</PRE
588 ></TD
589 ></TR
590 ></TABLE
591 ></P
592 ></DIV
593 ><DIV
594 CLASS="SECT3"
595 ><H3
596 CLASS="SECT3"
597 ><A
598 NAME="S12"
599 >4.3.3. Header file prototypes</A
600 ></H3
601 ><P
602 ><SPAN
603 CLASS="emphasis"
604 ><I
605 CLASS="EMPHASIS"
606 >Explanation:</I
607 ></SPAN
608 ></P
609 ><P
610 >Use a descriptive parameter name in the function prototype
611     in header files. Use the same parameter name in the header file
612     that you use in the c file.</P
613 ><P
614 ><SPAN
615 CLASS="emphasis"
616 ><I
617 CLASS="EMPHASIS"
618 >Example:</I
619 ></SPAN
620 ></P
621 ><TABLE
622 BORDER="0"
623 BGCOLOR="#E0E0E0"
624 WIDTH="100%"
625 ><TR
626 ><TD
627 ><PRE
628 CLASS="PROGRAMLISTING"
629 >(.h) extern int load_aclfile( struct client_state *csp );
630 (.c) int load_aclfile( struct client_state *csp )</PRE
631 ></TD
632 ></TR
633 ></TABLE
634 ><P
635 ><SPAN
636 CLASS="emphasis"
637 ><I
638 CLASS="EMPHASIS"
639 >Instead of:</I
640 ></SPAN
641 >
642 <TABLE
643 BORDER="0"
644 BGCOLOR="#E0E0E0"
645 WIDTH="100%"
646 ><TR
647 ><TD
648 ><PRE
649 CLASS="PROGRAMLISTING"
650 >(.h) extern int load_aclfile( struct client_state * ); or 
651 (.h) extern int load_aclfile(); 
652 (.c) int load_aclfile( struct client_state *csp )</PRE
653 ></TD
654 ></TR
655 ></TABLE
656 ></P
657 ></DIV
658 ><DIV
659 CLASS="SECT3"
660 ><H3
661 CLASS="SECT3"
662 ><A
663 NAME="S13"
664 >4.3.4. Enumerations, and #defines</A
665 ></H3
666 ><P
667 ><SPAN
668 CLASS="emphasis"
669 ><I
670 CLASS="EMPHASIS"
671 >Explanation:</I
672 ></SPAN
673 ></P
674 ><P
675 >Use all capital letters, with underscores between words. Do
676     not start an identifier with an underscore. (ANSI C reserves
677     these for use by the compiler and system headers.)</P
678 ><P
679 ><SPAN
680 CLASS="emphasis"
681 ><I
682 CLASS="EMPHASIS"
683 >Example:</I
684 ></SPAN
685 ></P
686 ><TABLE
687 BORDER="0"
688 BGCOLOR="#E0E0E0"
689 WIDTH="100%"
690 ><TR
691 ><TD
692 ><PRE
693 CLASS="PROGRAMLISTING"
694 >(enumeration) : enum Boolean { FALSE, TRUE };
695 (#define) : #define DEFAULT_SIZE 100;</PRE
696 ></TD
697 ></TR
698 ></TABLE
699 ><P
700 ><SPAN
701 CLASS="emphasis"
702 ><I
703 CLASS="EMPHASIS"
704 >Note:</I
705 ></SPAN
706 > We have a standard naming scheme for #defines
707     that toggle a feature in the preprocessor: FEATURE_&#62;, where
708     &#62; is a short (preferably 1 or 2 word) description.</P
709 ><P
710 ><SPAN
711 CLASS="emphasis"
712 ><I
713 CLASS="EMPHASIS"
714 >Example:</I
715 ></SPAN
716 ></P
717 ><TABLE
718 BORDER="0"
719 BGCOLOR="#E0E0E0"
720 WIDTH="100%"
721 ><TR
722 ><TD
723 ><PRE
724 CLASS="PROGRAMLISTING"
725 >#define FEATURE_FORCE 1
726
727 #ifdef FEATURE_FORCE
728 #define FORCE_PREFIX blah
729 #endif /* def FEATURE_FORCE */</PRE
730 ></TD
731 ></TR
732 ></TABLE
733 ></DIV
734 ><DIV
735 CLASS="SECT3"
736 ><H3
737 CLASS="SECT3"
738 ><A
739 NAME="S14"
740 >4.3.5. Constants</A
741 ></H3
742 ><P
743 ><SPAN
744 CLASS="emphasis"
745 ><I
746 CLASS="EMPHASIS"
747 >Explanation:</I
748 ></SPAN
749 ></P
750 ><P
751 >Spell common words out entirely (do not remove vowels).</P
752 ><P
753 >Use only widely-known domain acronyms and abbreviations.
754     Capitalize all letters of an acronym.</P
755 ><P
756 >Use underscore (_) to separate adjacent acronyms and
757     abbreviations. Never terminate a name with an underscore.</P
758 ><P
759 ><SPAN
760 CLASS="emphasis"
761 ><I
762 CLASS="EMPHASIS"
763 >Example:</I
764 ></SPAN
765 ></P
766 ><TABLE
767 BORDER="0"
768 BGCOLOR="#E0E0E0"
769 WIDTH="100%"
770 ><TR
771 ><TD
772 ><PRE
773 CLASS="PROGRAMLISTING"
774 >#define USE_IMAGE_LIST 1</PRE
775 ></TD
776 ></TR
777 ></TABLE
778 ><P
779 ><SPAN
780 CLASS="emphasis"
781 ><I
782 CLASS="EMPHASIS"
783 >Instead of:</I
784 ></SPAN
785 ></P
786 ><P
787 ><TABLE
788 BORDER="0"
789 BGCOLOR="#E0E0E0"
790 WIDTH="100%"
791 ><TR
792 ><TD
793 ><PRE
794 CLASS="PROGRAMLISTING"
795 >#define USE_IMG_LST 1 or 
796 #define _USE_IMAGE_LIST 1 or
797 #define USE_IMAGE_LIST_ 1 or 
798 #define use_image_list 1 or
799 #define UseImageList 1</PRE
800 ></TD
801 ></TR
802 ></TABLE
803 ></P
804 ></DIV
805 ></DIV
806 ><DIV
807 CLASS="SECT2"
808 ><H2
809 CLASS="SECT2"
810 ><A
811 NAME="S15"
812 >4.4. Using Space</A
813 ></H2
814 ><DIV
815 CLASS="SECT3"
816 ><H3
817 CLASS="SECT3"
818 ><A
819 NAME="S16"
820 >4.4.1. Put braces on a line by themselves.</A
821 ></H3
822 ><P
823 ><SPAN
824 CLASS="emphasis"
825 ><I
826 CLASS="EMPHASIS"
827 >Explanation:</I
828 ></SPAN
829 ></P
830 ><P
831 >The brace needs to be on a line all by itself, not at the
832     end of the statement. Curly braces should line up with the
833     construct that they're associated with. This practice makes it
834     easier to identify the opening and closing braces for a
835     block.</P
836 ><P
837 ><SPAN
838 CLASS="emphasis"
839 ><I
840 CLASS="EMPHASIS"
841 >Example:</I
842 ></SPAN
843 ></P
844 ><TABLE
845 BORDER="0"
846 BGCOLOR="#E0E0E0"
847 WIDTH="100%"
848 ><TR
849 ><TD
850 ><PRE
851 CLASS="PROGRAMLISTING"
852 >if ( this == that )
853 {
854    ...
855 }</PRE
856 ></TD
857 ></TR
858 ></TABLE
859 ><P
860 ><SPAN
861 CLASS="emphasis"
862 ><I
863 CLASS="EMPHASIS"
864 >Instead of:</I
865 ></SPAN
866 ></P
867 ><P
868 >if ( this == that ) { ... }</P
869 ><P
870 >or</P
871 ><P
872 >if ( this == that ) { ... }</P
873 ><P
874 ><SPAN
875 CLASS="emphasis"
876 ><I
877 CLASS="EMPHASIS"
878 >Note:</I
879 ></SPAN
880 > In the special case that the if-statement is
881     inside a loop, and it is trivial, i.e. it tests for a
882     condition that is obvious from the purpose of the block,
883     one-liners as above may optically preserve the loop structure
884     and make it easier to read.</P
885 ><P
886 ><SPAN
887 CLASS="emphasis"
888 ><I
889 CLASS="EMPHASIS"
890 >Status:</I
891 ></SPAN
892 > developer-discretion.</P
893 ><P
894 ><SPAN
895 CLASS="emphasis"
896 ><I
897 CLASS="EMPHASIS"
898 >Example exception:</I
899 ></SPAN
900 ></P
901 ><TABLE
902 BORDER="0"
903 BGCOLOR="#E0E0E0"
904 WIDTH="100%"
905 ><TR
906 ><TD
907 ><PRE
908 CLASS="PROGRAMLISTING"
909 >while ( more lines are read )
910 {
911    /* Please document what is/is not a comment line here */
912    if ( it's a comment ) continue;
913
914    do_something( line );
915 }</PRE
916 ></TD
917 ></TR
918 ></TABLE
919 ></DIV
920 ><DIV
921 CLASS="SECT3"
922 ><H3
923 CLASS="SECT3"
924 ><A
925 NAME="S17"
926 >4.4.2. ALL control statements should have a
927     block</A
928 ></H3
929 ><P
930 ><SPAN
931 CLASS="emphasis"
932 ><I
933 CLASS="EMPHASIS"
934 >Explanation:</I
935 ></SPAN
936 ></P
937 ><P
938 >Using braces to make a block will make your code more
939     readable and less prone to error. All control statements should
940     have a block defined.</P
941 ><P
942 ><SPAN
943 CLASS="emphasis"
944 ><I
945 CLASS="EMPHASIS"
946 >Example:</I
947 ></SPAN
948 ></P
949 ><TABLE
950 BORDER="0"
951 BGCOLOR="#E0E0E0"
952 WIDTH="100%"
953 ><TR
954 ><TD
955 ><PRE
956 CLASS="PROGRAMLISTING"
957 >if ( this == that )
958 {
959    do_something();
960    do_something_else();
961 }</PRE
962 ></TD
963 ></TR
964 ></TABLE
965 ><P
966 ><SPAN
967 CLASS="emphasis"
968 ><I
969 CLASS="EMPHASIS"
970 >Instead of:</I
971 ></SPAN
972 ></P
973 ><P
974 >if ( this == that ) do_something(); do_something_else();</P
975 ><P
976 >or</P
977 ><P
978 >if ( this == that ) do_something();</P
979 ><P
980 ><SPAN
981 CLASS="emphasis"
982 ><I
983 CLASS="EMPHASIS"
984 >Note:</I
985 ></SPAN
986 > The first example in "Instead of" will execute
987     in a manner other than that which the developer desired (per
988     indentation). Using code braces would have prevented this
989     "feature". The "explanation" and "exception" from the point
990     above also applies.</P
991 ></DIV
992 ><DIV
993 CLASS="SECT3"
994 ><H3
995 CLASS="SECT3"
996 ><A
997 NAME="S18"
998 >4.4.3. Do not belabor/blow-up boolean
999     expressions</A
1000 ></H3
1001 ><P
1002 ><SPAN
1003 CLASS="emphasis"
1004 ><I
1005 CLASS="EMPHASIS"
1006 >Example:</I
1007 ></SPAN
1008 ></P
1009 ><TABLE
1010 BORDER="0"
1011 BGCOLOR="#E0E0E0"
1012 WIDTH="100%"
1013 ><TR
1014 ><TD
1015 ><PRE
1016 CLASS="PROGRAMLISTING"
1017 >structure-&#62;flag = ( condition );</PRE
1018 ></TD
1019 ></TR
1020 ></TABLE
1021 ><P
1022 ><SPAN
1023 CLASS="emphasis"
1024 ><I
1025 CLASS="EMPHASIS"
1026 >Instead of:</I
1027 ></SPAN
1028 ></P
1029 ><P
1030 >if ( condition ) { structure-&#62;flag = 1; } else {
1031     structure-&#62;flag = 0; }</P
1032 ><P
1033 ><SPAN
1034 CLASS="emphasis"
1035 ><I
1036 CLASS="EMPHASIS"
1037 >Note:</I
1038 ></SPAN
1039 > The former is readable and concise. The later
1040     is wordy and inefficient. Please assume that any developer new
1041     to the project has at least a "good" knowledge of C/C++. (Hope
1042     I do not offend by that last comment ... 8-)</P
1043 ></DIV
1044 ><DIV
1045 CLASS="SECT3"
1046 ><H3
1047 CLASS="SECT3"
1048 ><A
1049 NAME="S19"
1050 >4.4.4. Use white space freely because it is
1051     free</A
1052 ></H3
1053 ><P
1054 ><SPAN
1055 CLASS="emphasis"
1056 ><I
1057 CLASS="EMPHASIS"
1058 >Explanation:</I
1059 ></SPAN
1060 ></P
1061 ><P
1062 >Make it readable. The notable exception to using white space
1063     freely is listed in the next guideline.</P
1064 ><P
1065 ><SPAN
1066 CLASS="emphasis"
1067 ><I
1068 CLASS="EMPHASIS"
1069 >Example:</I
1070 ></SPAN
1071 ></P
1072 ><TABLE
1073 BORDER="0"
1074 BGCOLOR="#E0E0E0"
1075 WIDTH="100%"
1076 ><TR
1077 ><TD
1078 ><PRE
1079 CLASS="PROGRAMLISTING"
1080 >int first_value   = 0;
1081 int some_value    = 0;
1082 int another_value = 0;
1083 int this_variable = 0;
1084
1085 if ( this_variable == this_variable )
1086
1087 first_value = old_value + ( ( some_value - another_value ) - whatever )</PRE
1088 ></TD
1089 ></TR
1090 ></TABLE
1091 ></DIV
1092 ><DIV
1093 CLASS="SECT3"
1094 ><H3
1095 CLASS="SECT3"
1096 ><A
1097 NAME="S20"
1098 >4.4.5. Don't use white space around structure
1099     operators</A
1100 ></H3
1101 ><P
1102 ><SPAN
1103 CLASS="emphasis"
1104 ><I
1105 CLASS="EMPHASIS"
1106 >Explanation:</I
1107 ></SPAN
1108 ></P
1109 ><P
1110 >- structure pointer operator ( "-&#62;" ) - member operator (
1111     "." ) - functions and parentheses</P
1112 ><P
1113 >It is a general coding practice to put pointers, references,
1114     and function parentheses next to names. With spaces, the
1115     connection between the object and variable/function name is not
1116     as clear.</P
1117 ><P
1118 ><SPAN
1119 CLASS="emphasis"
1120 ><I
1121 CLASS="EMPHASIS"
1122 >Example:</I
1123 ></SPAN
1124 ></P
1125 ><TABLE
1126 BORDER="0"
1127 BGCOLOR="#E0E0E0"
1128 WIDTH="100%"
1129 ><TR
1130 ><TD
1131 ><PRE
1132 CLASS="PROGRAMLISTING"
1133 >a_struct-&#62;a_member;
1134 a_struct.a_member;
1135 function_name();</PRE
1136 ></TD
1137 ></TR
1138 ></TABLE
1139 ><P
1140 ><SPAN
1141 CLASS="emphasis"
1142 ><I
1143 CLASS="EMPHASIS"
1144 >Instead of:</I
1145 ></SPAN
1146 > a_struct -&#62; a_member; a_struct . a_member;
1147     function_name ();</P
1148 ></DIV
1149 ><DIV
1150 CLASS="SECT3"
1151 ><H3
1152 CLASS="SECT3"
1153 ><A
1154 NAME="S21"
1155 >4.4.6. Make the last brace of a function stand
1156     out</A
1157 ></H3
1158 ><P
1159 ><SPAN
1160 CLASS="emphasis"
1161 ><I
1162 CLASS="EMPHASIS"
1163 >Example:</I
1164 ></SPAN
1165 ></P
1166 ><TABLE
1167 BORDER="0"
1168 BGCOLOR="#E0E0E0"
1169 WIDTH="100%"
1170 ><TR
1171 ><TD
1172 ><PRE
1173 CLASS="PROGRAMLISTING"
1174 >int function1( ... )
1175 {
1176    ...code...
1177    return( ret_code );
1178
1179 }   /* -END- function1 */
1180
1181
1182 int function2( ... )
1183 {
1184 }   /* -END- function2 */</PRE
1185 ></TD
1186 ></TR
1187 ></TABLE
1188 ><P
1189 ><SPAN
1190 CLASS="emphasis"
1191 ><I
1192 CLASS="EMPHASIS"
1193 >Instead of:</I
1194 ></SPAN
1195 ></P
1196 ><P
1197 >int function1( ... ) { ...code... return( ret_code ); } int
1198     function2( ... ) { }</P
1199 ><P
1200 ><SPAN
1201 CLASS="emphasis"
1202 ><I
1203 CLASS="EMPHASIS"
1204 >Note:</I
1205 ></SPAN
1206 > Use 1 blank line before the closing brace and 2
1207     lines afterward. This makes the end of function standout to
1208     the most casual viewer. Although function comments help
1209     separate functions, this is still a good coding practice. In
1210     fact, I follow these rules when using blocks in "for", "while",
1211     "do" loops, and long if {} statements too. After all whitespace
1212     is free!</P
1213 ><P
1214 ><SPAN
1215 CLASS="emphasis"
1216 ><I
1217 CLASS="EMPHASIS"
1218 >Status:</I
1219 ></SPAN
1220 > developer-discretion on the number of blank
1221     lines. Enforced is the end of function comments.</P
1222 ></DIV
1223 ><DIV
1224 CLASS="SECT3"
1225 ><H3
1226 CLASS="SECT3"
1227 ><A
1228 NAME="S22"
1229 >4.4.7. Use 3 character indentions</A
1230 ></H3
1231 ><P
1232 ><SPAN
1233 CLASS="emphasis"
1234 ><I
1235 CLASS="EMPHASIS"
1236 >Explanation:</I
1237 ></SPAN
1238 ></P
1239 ><P
1240 >If some use 8 character TABs and some use 3 character TABs,
1241     the code can look *very* ragged. So use 3 character indentions
1242     only. If you like to use TABs, pass your code through a filter
1243     such as "expand -t3" before checking in your code.</P
1244 ><P
1245 ><SPAN
1246 CLASS="emphasis"
1247 ><I
1248 CLASS="EMPHASIS"
1249 >Example:</I
1250 ></SPAN
1251 ></P
1252 ><TABLE
1253 BORDER="0"
1254 BGCOLOR="#E0E0E0"
1255 WIDTH="100%"
1256 ><TR
1257 ><TD
1258 ><PRE
1259 CLASS="PROGRAMLISTING"
1260 >static const char * const url_code_map[256] =
1261 {
1262    NULL, ...
1263 };
1264
1265
1266 int function1( ... )
1267 {
1268    if ( 1 )
1269    {
1270       return( ALWAYS_TRUE );
1271    }
1272    else
1273    {
1274       return( HOW_DID_YOU_GET_HERE );
1275    }
1276
1277    return( NEVER_GETS_HERE );
1278
1279 }</PRE
1280 ></TD
1281 ></TR
1282 ></TABLE
1283 ></DIV
1284 ></DIV
1285 ><DIV
1286 CLASS="SECT2"
1287 ><H2
1288 CLASS="SECT2"
1289 ><A
1290 NAME="S23"
1291 >4.5. Initializing</A
1292 ></H2
1293 ><DIV
1294 CLASS="SECT3"
1295 ><H3
1296 CLASS="SECT3"
1297 ><A
1298 NAME="S24"
1299 >4.5.1. Initialize all variables</A
1300 ></H3
1301 ><P
1302 ><SPAN
1303 CLASS="emphasis"
1304 ><I
1305 CLASS="EMPHASIS"
1306 >Explanation:</I
1307 ></SPAN
1308 ></P
1309 ><P
1310 >Do not assume that the variables declared will not be used
1311     until after they have been assigned a value somewhere else in
1312     the code. Remove the chance of accidentally using an unassigned
1313     variable.</P
1314 ><P
1315 ><SPAN
1316 CLASS="emphasis"
1317 ><I
1318 CLASS="EMPHASIS"
1319 >Example:</I
1320 ></SPAN
1321 ></P
1322 ><TABLE
1323 BORDER="0"
1324 BGCOLOR="#E0E0E0"
1325 WIDTH="100%"
1326 ><TR
1327 ><TD
1328 ><PRE
1329 CLASS="PROGRAMLISTING"
1330 >short a_short = 0;
1331 float a_float  = 0;
1332 struct *ptr = NULL;</PRE
1333 ></TD
1334 ></TR
1335 ></TABLE
1336 ><P
1337 ><SPAN
1338 CLASS="emphasis"
1339 ><I
1340 CLASS="EMPHASIS"
1341 >Note:</I
1342 ></SPAN
1343 > It is much easier to debug a SIGSEGV if the
1344     message says you are trying to access memory address 00000000
1345     and not 129FA012; or array_ptr[20] causes a SIGSEV vs.
1346     array_ptr[0].</P
1347 ><P
1348 ><SPAN
1349 CLASS="emphasis"
1350 ><I
1351 CLASS="EMPHASIS"
1352 >Status:</I
1353 ></SPAN
1354 > developer-discretion if and only if the
1355     variable is assigned a value "shortly after" declaration.</P
1356 ></DIV
1357 ></DIV
1358 ><DIV
1359 CLASS="SECT2"
1360 ><H2
1361 CLASS="SECT2"
1362 ><A
1363 NAME="S25"
1364 >4.6. Functions</A
1365 ></H2
1366 ><DIV
1367 CLASS="SECT3"
1368 ><H3
1369 CLASS="SECT3"
1370 ><A
1371 NAME="S26"
1372 >4.6.1. Name functions that return a boolean as a
1373     question.</A
1374 ></H3
1375 ><P
1376 ><SPAN
1377 CLASS="emphasis"
1378 ><I
1379 CLASS="EMPHASIS"
1380 >Explanation:</I
1381 ></SPAN
1382 ></P
1383 ><P
1384 >Value should be phrased as a question that would logically
1385     be answered as a true or false statement</P
1386 ><P
1387 ><SPAN
1388 CLASS="emphasis"
1389 ><I
1390 CLASS="EMPHASIS"
1391 >Example:</I
1392 ></SPAN
1393 ></P
1394 ><TABLE
1395 BORDER="0"
1396 BGCOLOR="#E0E0E0"
1397 WIDTH="100%"
1398 ><TR
1399 ><TD
1400 ><PRE
1401 CLASS="PROGRAMLISTING"
1402 >should_we_block_this();
1403 contains_an_image();
1404 is_web_page_blank();</PRE
1405 ></TD
1406 ></TR
1407 ></TABLE
1408 ></DIV
1409 ><DIV
1410 CLASS="SECT3"
1411 ><H3
1412 CLASS="SECT3"
1413 ><A
1414 NAME="S27"
1415 >4.6.2. Always specify a return type for a
1416     function.</A
1417 ></H3
1418 ><P
1419 ><SPAN
1420 CLASS="emphasis"
1421 ><I
1422 CLASS="EMPHASIS"
1423 >Explanation:</I
1424 ></SPAN
1425 ></P
1426 ><P
1427 >The default return for a function is an int. To avoid
1428     ambiguity, create a return for a function when the return has a
1429     purpose, and create a void return type if the function does not
1430     need to return anything.</P
1431 ></DIV
1432 ><DIV
1433 CLASS="SECT3"
1434 ><H3
1435 CLASS="SECT3"
1436 ><A
1437 NAME="S28"
1438 >4.6.3. Minimize function calls when iterating by
1439     using variables</A
1440 ></H3
1441 ><P
1442 ><SPAN
1443 CLASS="emphasis"
1444 ><I
1445 CLASS="EMPHASIS"
1446 >Explanation:</I
1447 ></SPAN
1448 ></P
1449 ><P
1450 >It is easy to write the following code, and a clear argument
1451     can be made that the code is easy to understand:</P
1452 ><P
1453 ><SPAN
1454 CLASS="emphasis"
1455 ><I
1456 CLASS="EMPHASIS"
1457 >Example:</I
1458 ></SPAN
1459 ></P
1460 ><TABLE
1461 BORDER="0"
1462 BGCOLOR="#E0E0E0"
1463 WIDTH="100%"
1464 ><TR
1465 ><TD
1466 ><PRE
1467 CLASS="PROGRAMLISTING"
1468 >for ( size_t cnt = 0; cnt &#60; block_list_length(); cnt++ )
1469 {
1470    ....
1471 }</PRE
1472 ></TD
1473 ></TR
1474 ></TABLE
1475 ><P
1476 ><SPAN
1477 CLASS="emphasis"
1478 ><I
1479 CLASS="EMPHASIS"
1480 >Note:</I
1481 ></SPAN
1482 > Unfortunately, this makes a function call for
1483     each and every iteration. This increases the overhead in the
1484     program, because the compiler has to look up the function each
1485     time, call it, and return a value. Depending on what occurs in
1486     the block_list_length() call, it might even be creating and
1487     destroying structures with each iteration, even though in each
1488     case it is comparing "cnt" to the same value, over and over.
1489     Remember too - even a call to block_list_length() is a function
1490     call, with the same overhead.</P
1491 ><P
1492 >Instead of using a function call during the iterations,
1493     assign the value to a variable, and evaluate using the
1494     variable.</P
1495 ><P
1496 ><SPAN
1497 CLASS="emphasis"
1498 ><I
1499 CLASS="EMPHASIS"
1500 >Example:</I
1501 ></SPAN
1502 ></P
1503 ><TABLE
1504 BORDER="0"
1505 BGCOLOR="#E0E0E0"
1506 WIDTH="100%"
1507 ><TR
1508 ><TD
1509 ><PRE
1510 CLASS="PROGRAMLISTING"
1511 >size_t len = block_list_length();
1512
1513 for ( size_t cnt = 0; cnt &#60; len; cnt++ )
1514 {
1515    ....
1516 }</PRE
1517 ></TD
1518 ></TR
1519 ></TABLE
1520 ><P
1521 ><SPAN
1522 CLASS="emphasis"
1523 ><I
1524 CLASS="EMPHASIS"
1525 >Exceptions:</I
1526 ></SPAN
1527 > if the value of block_list_length()
1528     *may* change or could *potentially* change, then you must code the
1529     function call in the for/while loop.</P
1530 ></DIV
1531 ><DIV
1532 CLASS="SECT3"
1533 ><H3
1534 CLASS="SECT3"
1535 ><A
1536 NAME="S29"
1537 >4.6.4. Pass and Return by Const Reference</A
1538 ></H3
1539 ><P
1540 ><SPAN
1541 CLASS="emphasis"
1542 ><I
1543 CLASS="EMPHASIS"
1544 >Explanation:</I
1545 ></SPAN
1546 ></P
1547 ><P
1548 >This allows a developer to define a const pointer and call
1549     your function. If your function does not have the const
1550     keyword, we may not be able to use your function. Consider
1551     strcmp, if it were defined as: extern int strcmp( char *s1,
1552     char *s2 );</P
1553 ><P
1554 >I could then not use it to compare argv's in main: int main(
1555     int argc, const char *argv[] ) { strcmp( argv[0], "privoxy"
1556     ); }</P
1557 ><P
1558 >Both these pointers are *const*! If the c runtime library
1559     maintainers do it, we should too.</P
1560 ></DIV
1561 ><DIV
1562 CLASS="SECT3"
1563 ><H3
1564 CLASS="SECT3"
1565 ><A
1566 NAME="S30"
1567 >4.6.5. Pass and Return by Value</A
1568 ></H3
1569 ><P
1570 ><SPAN
1571 CLASS="emphasis"
1572 ><I
1573 CLASS="EMPHASIS"
1574 >Explanation:</I
1575 ></SPAN
1576 ></P
1577 ><P
1578 >Most structures cannot fit onto a normal stack entry (i.e.
1579     they are not 4 bytes or less). Aka, a function declaration
1580     like: int load_aclfile( struct client_state csp )</P
1581 ><P
1582 >would not work. So, to be consistent, we should declare all
1583     prototypes with "pass by value": int load_aclfile( struct
1584     client_state *csp )</P
1585 ></DIV
1586 ><DIV
1587 CLASS="SECT3"
1588 ><H3
1589 CLASS="SECT3"
1590 ><A
1591 NAME="S31"
1592 >4.6.6. Names of include files</A
1593 ></H3
1594 ><P
1595 ><SPAN
1596 CLASS="emphasis"
1597 ><I
1598 CLASS="EMPHASIS"
1599 >Explanation:</I
1600 ></SPAN
1601 ></P
1602 ><P
1603 >Your include statements should contain the file name without
1604     a path. The path should be listed in the Makefile, using -I as
1605     processor directive to search the indicated paths. An exception
1606     to this would be for some proprietary software that utilizes a
1607     partial path to distinguish their header files from system or
1608     other header files.</P
1609 ><P
1610 ><SPAN
1611 CLASS="emphasis"
1612 ><I
1613 CLASS="EMPHASIS"
1614 >Example:</I
1615 ></SPAN
1616 ></P
1617 ><TABLE
1618 BORDER="0"
1619 BGCOLOR="#E0E0E0"
1620 WIDTH="100%"
1621 ><TR
1622 ><TD
1623 ><PRE
1624 CLASS="PROGRAMLISTING"
1625 >#include &#60;iostream.h&#62;     /* This is not a local include */
1626 #include "config.h"       /* This IS a local include */</PRE
1627 ></TD
1628 ></TR
1629 ></TABLE
1630 ><P
1631 ><SPAN
1632 CLASS="emphasis"
1633 ><I
1634 CLASS="EMPHASIS"
1635 >Exception:</I
1636 ></SPAN
1637 ></P
1638 ><P
1639 ><TABLE
1640 BORDER="0"
1641 BGCOLOR="#E0E0E0"
1642 WIDTH="100%"
1643 ><TR
1644 ><TD
1645 ><PRE
1646 CLASS="PROGRAMLISTING"
1647 >/* This is not a local include, but requires a path element. */ 
1648 #include &#60;sys/fileName.h&#62;</PRE
1649 ></TD
1650 ></TR
1651 ></TABLE
1652 ></P
1653 ><P
1654 ><SPAN
1655 CLASS="emphasis"
1656 ><I
1657 CLASS="EMPHASIS"
1658 >Note:</I
1659 ></SPAN
1660 > Please! do not add "-I." to the Makefile
1661     without a _very_ good reason. This duplicates the #include
1662     "file.h" behavior.</P
1663 ></DIV
1664 ><DIV
1665 CLASS="SECT3"
1666 ><H3
1667 CLASS="SECT3"
1668 ><A
1669 NAME="S32"
1670 >4.6.7. Provide multiple inclusion
1671     protection</A
1672 ></H3
1673 ><P
1674 ><SPAN
1675 CLASS="emphasis"
1676 ><I
1677 CLASS="EMPHASIS"
1678 >Explanation:</I
1679 ></SPAN
1680 ></P
1681 ><P
1682 >Prevents compiler and linker errors resulting from
1683     redefinition of items.</P
1684 ><P
1685 >Wrap each header file with the following syntax to prevent
1686     multiple inclusions of the file. Of course, replace PROJECT_H
1687     with your file name, with "." Changed to "_", and make it
1688     uppercase.</P
1689 ><P
1690 ><SPAN
1691 CLASS="emphasis"
1692 ><I
1693 CLASS="EMPHASIS"
1694 >Example:</I
1695 ></SPAN
1696 ></P
1697 ><TABLE
1698 BORDER="0"
1699 BGCOLOR="#E0E0E0"
1700 WIDTH="100%"
1701 ><TR
1702 ><TD
1703 ><PRE
1704 CLASS="PROGRAMLISTING"
1705 >#ifndef PROJECT_H_INCLUDED
1706 #define PROJECT_H_INCLUDED
1707  ...
1708 #endif /* ndef PROJECT_H_INCLUDED */</PRE
1709 ></TD
1710 ></TR
1711 ></TABLE
1712 ></DIV
1713 ><DIV
1714 CLASS="SECT3"
1715 ><H3
1716 CLASS="SECT3"
1717 ><A
1718 NAME="S33"
1719 >4.6.8. Use `extern "C"` when appropriate</A
1720 ></H3
1721 ><P
1722 ><SPAN
1723 CLASS="emphasis"
1724 ><I
1725 CLASS="EMPHASIS"
1726 >Explanation:</I
1727 ></SPAN
1728 ></P
1729 ><P
1730 >If our headers are included from C++, they must declare our
1731     functions as `extern "C"`. This has no cost in C, but increases
1732     the potential re-usability of our code.</P
1733 ><P
1734 ><SPAN
1735 CLASS="emphasis"
1736 ><I
1737 CLASS="EMPHASIS"
1738 >Example:</I
1739 ></SPAN
1740 ></P
1741 ><TABLE
1742 BORDER="0"
1743 BGCOLOR="#E0E0E0"
1744 WIDTH="100%"
1745 ><TR
1746 ><TD
1747 ><PRE
1748 CLASS="PROGRAMLISTING"
1749 >#ifdef __cplusplus
1750 extern "C"
1751 {
1752 #endif /* def __cplusplus */
1753
1754 ... function definitions here ...
1755
1756 #ifdef __cplusplus
1757 }
1758 #endif /* def __cplusplus */</PRE
1759 ></TD
1760 ></TR
1761 ></TABLE
1762 ></DIV
1763 ><DIV
1764 CLASS="SECT3"
1765 ><H3
1766 CLASS="SECT3"
1767 ><A
1768 NAME="S34"
1769 >4.6.9. Where Possible, Use Forward Struct
1770     Declaration Instead of Includes</A
1771 ></H3
1772 ><P
1773 ><SPAN
1774 CLASS="emphasis"
1775 ><I
1776 CLASS="EMPHASIS"
1777 >Explanation:</I
1778 ></SPAN
1779 ></P
1780 ><P
1781 >Useful in headers that include pointers to other struct's.
1782     Modifications to excess header files may cause needless
1783     compiles.</P
1784 ><P
1785 ><SPAN
1786 CLASS="emphasis"
1787 ><I
1788 CLASS="EMPHASIS"
1789 >Example:</I
1790 ></SPAN
1791 ></P
1792 ><TABLE
1793 BORDER="0"
1794 BGCOLOR="#E0E0E0"
1795 WIDTH="100%"
1796 ><TR
1797 ><TD
1798 ><PRE
1799 CLASS="PROGRAMLISTING"
1800 >/*********************************************************************
1801  * We're avoiding an include statement here!
1802  *********************************************************************/
1803 struct file_list;
1804 extern file_list *xyz;</PRE
1805 ></TD
1806 ></TR
1807 ></TABLE
1808 ><P
1809 ><SPAN
1810 CLASS="emphasis"
1811 ><I
1812 CLASS="EMPHASIS"
1813 >Note:</I
1814 ></SPAN
1815 > If you declare "file_list xyz;" (without the
1816     pointer), then including the proper header file is necessary.
1817     If you only want to prototype a pointer, however, the header
1818     file is unnecessary.</P
1819 ><P
1820 ><SPAN
1821 CLASS="emphasis"
1822 ><I
1823 CLASS="EMPHASIS"
1824 >Status:</I
1825 ></SPAN
1826 > Use with discretion.</P
1827 ></DIV
1828 ></DIV
1829 ><DIV
1830 CLASS="SECT2"
1831 ><H2
1832 CLASS="SECT2"
1833 ><A
1834 NAME="S35"
1835 >4.7. General Coding Practices</A
1836 ></H2
1837 ><DIV
1838 CLASS="SECT3"
1839 ><H3
1840 CLASS="SECT3"
1841 ><A
1842 NAME="S36"
1843 >4.7.1. Turn on warnings</A
1844 ></H3
1845 ><P
1846 ><SPAN
1847 CLASS="emphasis"
1848 ><I
1849 CLASS="EMPHASIS"
1850 >Explanation</I
1851 ></SPAN
1852 ></P
1853 ><P
1854 >Compiler warnings are meant to help you find bugs. You
1855     should turn on as many as possible. With GCC, the switch is
1856     "-Wall". Try and fix as many warnings as possible.</P
1857 ></DIV
1858 ><DIV
1859 CLASS="SECT3"
1860 ><H3
1861 CLASS="SECT3"
1862 ><A
1863 NAME="S37"
1864 >4.7.2. Provide a default case for all switch
1865     statements</A
1866 ></H3
1867 ><P
1868 ><SPAN
1869 CLASS="emphasis"
1870 ><I
1871 CLASS="EMPHASIS"
1872 >Explanation:</I
1873 ></SPAN
1874 ></P
1875 ><P
1876 >What you think is guaranteed is never really guaranteed. The
1877     value that you don't think you need to check is the one that
1878     someday will be passed. So, to protect yourself from the
1879     unknown, always have a default step in a switch statement.</P
1880 ><P
1881 ><SPAN
1882 CLASS="emphasis"
1883 ><I
1884 CLASS="EMPHASIS"
1885 >Example:</I
1886 ></SPAN
1887 ></P
1888 ><TABLE
1889 BORDER="0"
1890 BGCOLOR="#E0E0E0"
1891 WIDTH="100%"
1892 ><TR
1893 ><TD
1894 ><PRE
1895 CLASS="PROGRAMLISTING"
1896 >switch( hash_string( cmd ) )
1897 {
1898    case hash_actions_file :
1899       ... code ...
1900       break;
1901
1902    case hash_confdir :
1903       ... code ...
1904       break;
1905
1906    default :
1907       log_error( ... );
1908       ... anomaly code goes here ...
1909       continue; / break; / exit( 1 ); / etc ...
1910
1911 } /* end switch( hash_string( cmd ) ) */</PRE
1912 ></TD
1913 ></TR
1914 ></TABLE
1915 ><P
1916 ><SPAN
1917 CLASS="emphasis"
1918 ><I
1919 CLASS="EMPHASIS"
1920 >Note:</I
1921 ></SPAN
1922 > If you already have a default condition, you
1923     are obviously exempt from this point. Of note, most of the
1924     WIN32 code calls `DefWindowProc' after the switch statement.
1925     This API call *should* be included in a default statement.</P
1926 ><P
1927 ><SPAN
1928 CLASS="emphasis"
1929 ><I
1930 CLASS="EMPHASIS"
1931 >Another Note:</I
1932 ></SPAN
1933 > This is not so much a readability issue
1934     as a robust programming issue. The "anomaly code goes here" may
1935     be no more than a print to the STDERR stream (as in
1936     load_config). Or it may really be an abort condition.</P
1937 ><P
1938 ><SPAN
1939 CLASS="emphasis"
1940 ><I
1941 CLASS="EMPHASIS"
1942 >Status:</I
1943 ></SPAN
1944 > Programmer discretion is advised.</P
1945 ></DIV
1946 ><DIV
1947 CLASS="SECT3"
1948 ><H3
1949 CLASS="SECT3"
1950 ><A
1951 NAME="S38"
1952 >4.7.3. Try to avoid falling through cases in a
1953     switch statement.</A
1954 ></H3
1955 ><P
1956 ><SPAN
1957 CLASS="emphasis"
1958 ><I
1959 CLASS="EMPHASIS"
1960 >Explanation:</I
1961 ></SPAN
1962 ></P
1963 ><P
1964 >In general, you will want to have a 'break' statement within
1965     each 'case' of a switch statement. This allows for the code to
1966     be more readable and understandable, and furthermore can
1967     prevent unwanted surprises if someone else later gets creative
1968     and moves the code around.</P
1969 ><P
1970 >The language allows you to plan the fall through from one
1971     case statement to another simply by omitting the break
1972     statement within the case statement. This feature does have
1973     benefits, but should only be used in rare cases. In general,
1974     use a break statement for each case statement.</P
1975 ><P
1976 >If you choose to allow fall through, you should comment both
1977     the fact of the fall through and reason why you felt it was
1978     necessary.</P
1979 ></DIV
1980 ><DIV
1981 CLASS="SECT3"
1982 ><H3
1983 CLASS="SECT3"
1984 ><A
1985 NAME="S39"
1986 >4.7.4. Use 'long' or 'short' Instead of
1987     'int'</A
1988 ></H3
1989 ><P
1990 ><SPAN
1991 CLASS="emphasis"
1992 ><I
1993 CLASS="EMPHASIS"
1994 >Explanation:</I
1995 ></SPAN
1996 ></P
1997 ><P
1998 >On 32-bit platforms, int usually has the range of long. On
1999     16-bit platforms, int has the range of short.</P
2000 ><P
2001 ><SPAN
2002 CLASS="emphasis"
2003 ><I
2004 CLASS="EMPHASIS"
2005 >Status:</I
2006 ></SPAN
2007 > open-to-debate. In the case of most FSF
2008     projects (including X/GNU-Emacs), there are typedefs to int4,
2009     int8, int16, (or equivalence ... I forget the exact typedefs
2010     now). Should we add these to IJB now that we have a "configure"
2011     script?</P
2012 ></DIV
2013 ><DIV
2014 CLASS="SECT3"
2015 ><H3
2016 CLASS="SECT3"
2017 ><A
2018 NAME="S40"
2019 >4.7.5. Don't mix size_t and other types</A
2020 ></H3
2021 ><P
2022 ><SPAN
2023 CLASS="emphasis"
2024 ><I
2025 CLASS="EMPHASIS"
2026 >Explanation:</I
2027 ></SPAN
2028 ></P
2029 ><P
2030 >The type of size_t varies across platforms. Do not make
2031     assumptions about whether it is signed or unsigned, or about
2032     how long it is. Do not compare a size_t against another
2033     variable of a different type (or even against a constant)
2034     without casting one of the values.</P
2035 ></DIV
2036 ><DIV
2037 CLASS="SECT3"
2038 ><H3
2039 CLASS="SECT3"
2040 ><A
2041 NAME="S41"
2042 >4.7.6. Declare each variable and struct on its
2043     own line.</A
2044 ></H3
2045 ><P
2046 ><SPAN
2047 CLASS="emphasis"
2048 ><I
2049 CLASS="EMPHASIS"
2050 >Explanation:</I
2051 ></SPAN
2052 ></P
2053 ><P
2054 >It can be tempting to declare a series of variables all on
2055     one line. Don't.</P
2056 ><P
2057 ><SPAN
2058 CLASS="emphasis"
2059 ><I
2060 CLASS="EMPHASIS"
2061 >Example:</I
2062 ></SPAN
2063 ></P
2064 ><TABLE
2065 BORDER="0"
2066 BGCOLOR="#E0E0E0"
2067 WIDTH="100%"
2068 ><TR
2069 ><TD
2070 ><PRE
2071 CLASS="PROGRAMLISTING"
2072 >long a = 0;
2073 long b = 0;
2074 long c = 0;</PRE
2075 ></TD
2076 ></TR
2077 ></TABLE
2078 ><P
2079 ><SPAN
2080 CLASS="emphasis"
2081 ><I
2082 CLASS="EMPHASIS"
2083 >Instead of:</I
2084 ></SPAN
2085 ></P
2086 ><P
2087 >long a, b, c;</P
2088 ><P
2089 ><SPAN
2090 CLASS="emphasis"
2091 ><I
2092 CLASS="EMPHASIS"
2093 >Explanation:</I
2094 ></SPAN
2095 > - there is more room for comments on the
2096     individual variables - easier to add new variables without
2097     messing up the original ones - when searching on a variable to
2098     find its type, there is less clutter to "visually"
2099     eliminate</P
2100 ><P
2101 ><SPAN
2102 CLASS="emphasis"
2103 ><I
2104 CLASS="EMPHASIS"
2105 >Exceptions:</I
2106 ></SPAN
2107 > when you want to declare a bunch of loop
2108     variables or other trivial variables; feel free to declare them
2109     on one line. You should, although, provide a good comment on
2110     their functions.</P
2111 ><P
2112 ><SPAN
2113 CLASS="emphasis"
2114 ><I
2115 CLASS="EMPHASIS"
2116 >Status:</I
2117 ></SPAN
2118 > developer-discretion.</P
2119 ></DIV
2120 ><DIV
2121 CLASS="SECT3"
2122 ><H3
2123 CLASS="SECT3"
2124 ><A
2125 NAME="S42"
2126 >4.7.7. Use malloc/zalloc sparingly</A
2127 ></H3
2128 ><P
2129 ><SPAN
2130 CLASS="emphasis"
2131 ><I
2132 CLASS="EMPHASIS"
2133 >Explanation:</I
2134 ></SPAN
2135 ></P
2136 ><P
2137 >Create a local struct (on the stack) if the variable will
2138     live and die within the context of one function call.</P
2139 ><P
2140 >Only "malloc" a struct (on the heap) if the variable's life
2141     will extend beyond the context of one function call.</P
2142 ><P
2143 ><SPAN
2144 CLASS="emphasis"
2145 ><I
2146 CLASS="EMPHASIS"
2147 >Example:</I
2148 ></SPAN
2149 ></P
2150 ><TABLE
2151 BORDER="0"
2152 BGCOLOR="#E0E0E0"
2153 WIDTH="100%"
2154 ><TR
2155 ><TD
2156 ><PRE
2157 CLASS="PROGRAMLISTING"
2158 >If a function creates a struct and stores a pointer to it in a
2159 list, then it should definitely be allocated via `malloc'.</PRE
2160 ></TD
2161 ></TR
2162 ></TABLE
2163 ></DIV
2164 ><DIV
2165 CLASS="SECT3"
2166 ><H3
2167 CLASS="SECT3"
2168 ><A
2169 NAME="S43"
2170 >4.7.8. The Programmer Who Uses 'malloc' is
2171     Responsible for Ensuring 'free'</A
2172 ></H3
2173 ><P
2174 ><SPAN
2175 CLASS="emphasis"
2176 ><I
2177 CLASS="EMPHASIS"
2178 >Explanation:</I
2179 ></SPAN
2180 ></P
2181 ><P
2182 >If you have to "malloc" an instance, you are responsible for
2183     insuring that the instance is `free'd, even if the deallocation
2184     event falls within some other programmer's code. You are also
2185     responsible for ensuring that deletion is timely (i.e. not too
2186     soon, not too late). This is known as "low-coupling" and is a
2187     "good thing (tm)". You may need to offer a
2188     free/unload/destructor type function to accommodate this.</P
2189 ><P
2190 ><SPAN
2191 CLASS="emphasis"
2192 ><I
2193 CLASS="EMPHASIS"
2194 >Example:</I
2195 ></SPAN
2196 ></P
2197 ><TABLE
2198 BORDER="0"
2199 BGCOLOR="#E0E0E0"
2200 WIDTH="100%"
2201 ><TR
2202 ><TD
2203 ><PRE
2204 CLASS="PROGRAMLISTING"
2205 >int load_re_filterfile( struct client_state *csp ) { ... }
2206 static void unload_re_filterfile( void *f ) { ... }</PRE
2207 ></TD
2208 ></TR
2209 ></TABLE
2210 ><P
2211 ><SPAN
2212 CLASS="emphasis"
2213 ><I
2214 CLASS="EMPHASIS"
2215 >Exceptions:</I
2216 ></SPAN
2217 ></P
2218 ><P
2219 >The developer cannot be expected to provide `free'ing
2220     functions for C run-time library functions ... such as
2221     `strdup'.</P
2222 ><P
2223 ><SPAN
2224 CLASS="emphasis"
2225 ><I
2226 CLASS="EMPHASIS"
2227 >Status:</I
2228 ></SPAN
2229 > developer-discretion. The "main" use of this
2230     standard is for allocating and freeing data structures (complex
2231     or nested).</P
2232 ></DIV
2233 ><DIV
2234 CLASS="SECT3"
2235 ><H3
2236 CLASS="SECT3"
2237 ><A
2238 NAME="S44"
2239 >4.7.9. Add loaders to the `file_list' structure
2240     and in order</A
2241 ></H3
2242 ><P
2243 ><SPAN
2244 CLASS="emphasis"
2245 ><I
2246 CLASS="EMPHASIS"
2247 >Explanation:</I
2248 ></SPAN
2249 ></P
2250 ><P
2251 >I have ordered all of the "blocker" file code to be in alpha
2252     order. It is easier to add/read new blockers when you expect a
2253     certain order.</P
2254 ><P
2255 ><SPAN
2256 CLASS="emphasis"
2257 ><I
2258 CLASS="EMPHASIS"
2259 >Note:</I
2260 ></SPAN
2261 > It may appear that the alpha order is broken in
2262     places by POPUP tests coming before PCRS tests. But since
2263     POPUPs can also be referred to as KILLPOPUPs, it is clear that
2264     it should come first.</P
2265 ></DIV
2266 ><DIV
2267 CLASS="SECT3"
2268 ><H3
2269 CLASS="SECT3"
2270 ><A
2271 NAME="S45"
2272 >4.7.10. "Uncertain" new code and/or changes to
2273     existing code, use FIXME or XXX</A
2274 ></H3
2275 ><P
2276 ><SPAN
2277 CLASS="emphasis"
2278 ><I
2279 CLASS="EMPHASIS"
2280 >Explanation:</I
2281 ></SPAN
2282 ></P
2283 ><P
2284 >If you have enough confidence in new code or confidence in
2285     your changes, but are not *quite* sure of the repercussions,
2286     add this:</P
2287 ><P
2288 >/* FIXME: this code has a logic error on platform XYZ, *
2289     attempting to fix */ #ifdef PLATFORM ...changed code here...
2290     #endif</P
2291 ><P
2292 >or:</P
2293 ><P
2294 >/* FIXME: I think the original author really meant this...
2295     */ ...changed code here...</P
2296 ><P
2297 >or:</P
2298 ><P
2299 >/* FIXME: new code that *may* break something else... */
2300     ...new code here...</P
2301 ><P
2302 ><SPAN
2303 CLASS="emphasis"
2304 ><I
2305 CLASS="EMPHASIS"
2306 >Note:</I
2307 ></SPAN
2308 > If you make it clear that this may or may not
2309     be a "good thing (tm)", it will be easier to identify and
2310     include in the project (or conversely exclude from the
2311     project).</P
2312 ></DIV
2313 ></DIV
2314 ><DIV
2315 CLASS="SECT2"
2316 ><H2
2317 CLASS="SECT2"
2318 ><A
2319 NAME="S46"
2320 >4.8. Addendum: Template for files and function
2321     comment blocks:</A
2322 ></H2
2323 ><P
2324 ><SPAN
2325 CLASS="emphasis"
2326 ><I
2327 CLASS="EMPHASIS"
2328 >Example for file comments:</I
2329 ></SPAN
2330 ></P
2331 ><TABLE
2332 BORDER="0"
2333 BGCOLOR="#E0E0E0"
2334 WIDTH="100%"
2335 ><TR
2336 ><TD
2337 ><PRE
2338 CLASS="PROGRAMLISTING"
2339 >const char FILENAME_rcs[] = "$Id: developer-manual.sgml,v 2.19 2008/05/12 11:13:33 fabiankeil Exp $";
2340 /*********************************************************************
2341  *
2342  * File        :  $Source$
2343  *
2344  * Purpose     :  (Fill me in with a good description!)
2345  *
2346  * Copyright   :  Written by and Copyright (C) 2001-2007 the SourceForge
2347  *                Privoxy team. http://www.privoxy.org/
2348  *
2349  *                Based on the Internet Junkbuster originally written
2350  *                by and Copyright (C) 1997 Anonymous Coders and
2351  *                Junkbusters Corporation.  http://www.junkbusters.com
2352  *
2353  *                This program is free software; you can redistribute it
2354  *                and/or modify it under the terms of the GNU General
2355  *                Public License as published by the Free Software
2356  *                Foundation; either version 2 of the License, or (at
2357  *                your option) any later version.
2358  *
2359  *                This program is distributed in the hope that it will
2360  *                be useful, but WITHOUT ANY WARRANTY; without even the
2361  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
2362  *                PARTICULAR PURPOSE.  See the GNU General Public
2363  *                License for more details.
2364  *
2365  *                The GNU General Public License should be included with
2366  *                this file.  If not, you can view it at
2367  *                http://www.gnu.org/copyleft/gpl.html
2368  *                or write to the Free Software Foundation, Inc., 
2369  *                51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ,
2370  *                USA
2371  *
2372  * Revisions   :
2373  *    $Log$
2374  *
2375  *********************************************************************/
2376
2377
2378 #include "config.h"
2379
2380    ...necessary include files for us to do our work...
2381
2382 const char FILENAME_h_rcs[] = FILENAME_H_VERSION;</PRE
2383 ></TD
2384 ></TR
2385 ></TABLE
2386 ><P
2387 ><SPAN
2388 CLASS="emphasis"
2389 ><I
2390 CLASS="EMPHASIS"
2391 >Note:</I
2392 ></SPAN
2393 > This declares the rcs variables that should be
2394     added to the "show-proxy-args" page. If this is a brand new
2395     creation by you, you are free to change the "Copyright" section
2396     to represent the rights you wish to maintain.</P
2397 ><P
2398 ><SPAN
2399 CLASS="emphasis"
2400 ><I
2401 CLASS="EMPHASIS"
2402 >Note:</I
2403 ></SPAN
2404 > The formfeed character that is present right
2405     after the comment flower box is handy for (X|GNU)Emacs users to
2406     skip the verbiage and get to the heart of the code (via
2407     `forward-page' and `backward-page'). Please include it if you
2408     can.</P
2409 ><P
2410 ><SPAN
2411 CLASS="emphasis"
2412 ><I
2413 CLASS="EMPHASIS"
2414 >Example for file header comments:</I
2415 ></SPAN
2416 ></P
2417 ><TABLE
2418 BORDER="0"
2419 BGCOLOR="#E0E0E0"
2420 WIDTH="100%"
2421 ><TR
2422 ><TD
2423 ><PRE
2424 CLASS="PROGRAMLISTING"
2425 >#ifndef _FILENAME_H
2426 #define _FILENAME_H
2427 #define FILENAME_H_VERSION "$Id: developer-manual.sgml,v 2.19 2008/05/12 11:13:33 fabiankeil Exp $"
2428 /*********************************************************************
2429  *
2430  * File        :  $Source$
2431  *
2432  * Purpose     :  (Fill me in with a good description!)
2433  *
2434  * Copyright   :  Written by and Copyright (C) 2001-2007 the SourceForge
2435  *                Privoxy team. http://www.privoxy.org/
2436  *
2437  *                Based on the Internet Junkbuster originally written
2438  *                by and Copyright (C) 1997 Anonymous Coders and
2439  *                Junkbusters Corporation.  http://www.junkbusters.com
2440  *
2441  *                This program is free software; you can redistribute it
2442  *                and/or modify it under the terms of the GNU General
2443  *                Public License as published by the Free Software
2444  *                Foundation; either version 2 of the License, or (at
2445  *                your option) any later version.
2446  *
2447  *                This program is distributed in the hope that it will
2448  *                be useful, but WITHOUT ANY WARRANTY; without even the
2449  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
2450  *                PARTICULAR PURPOSE.  See the GNU General Public
2451  *                License for more details.
2452  *
2453  *                The GNU General Public License should be included with
2454  *                this file.  If not, you can view it at
2455  *                http://www.gnu.org/copyleft/gpl.html
2456  *                or write to the Free Software Foundation, Inc., 
2457  *                51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ,
2458  *                USA
2459  *
2460  * Revisions   :
2461  *    $Log$
2462  *
2463  *********************************************************************/
2464
2465
2466 #include "project.h"
2467
2468 #ifdef __cplusplus
2469 extern "C" {
2470 #endif
2471
2472    ... function headers here ...
2473
2474
2475 /* Revision control strings from this header and associated .c file */
2476 extern const char FILENAME_rcs[];
2477 extern const char FILENAME_h_rcs[];
2478
2479
2480 #ifdef __cplusplus
2481 } /* extern "C" */
2482 #endif
2483
2484 #endif /* ndef _FILENAME_H */
2485
2486 /*
2487   Local Variables:
2488   tab-width: 3
2489   end:
2490 */</PRE
2491 ></TD
2492 ></TR
2493 ></TABLE
2494 ><P
2495 ><SPAN
2496 CLASS="emphasis"
2497 ><I
2498 CLASS="EMPHASIS"
2499 >Example for function comments:</I
2500 ></SPAN
2501 ></P
2502 ><TABLE
2503 BORDER="0"
2504 BGCOLOR="#E0E0E0"
2505 WIDTH="100%"
2506 ><TR
2507 ><TD
2508 ><PRE
2509 CLASS="PROGRAMLISTING"
2510 >/*********************************************************************
2511  *
2512  * Function    :  FUNCTION_NAME
2513  *
2514  * Description :  (Fill me in with a good description!)
2515  *
2516  * parameters  :
2517  *          1  :  param1 = pointer to an important thing
2518  *          2  :  x      = pointer to something else
2519  *
2520  * Returns     :  0 =&#62; Ok, everything else is an error.
2521  *
2522  *********************************************************************/
2523 int FUNCTION_NAME( void *param1, const char *x )
2524 {
2525    ...
2526    return( 0 );
2527
2528 }</PRE
2529 ></TD
2530 ></TR
2531 ></TABLE
2532 ><P
2533 ><SPAN
2534 CLASS="emphasis"
2535 ><I
2536 CLASS="EMPHASIS"
2537 >Note:</I
2538 ></SPAN
2539 > If we all follow this practice, we should be
2540     able to parse our code to create a "self-documenting" web
2541     page.</P
2542 ></DIV
2543 ></DIV
2544 ><DIV
2545 CLASS="NAVFOOTER"
2546 ><HR
2547 ALIGN="LEFT"
2548 WIDTH="100%"><TABLE
2549 SUMMARY="Footer navigation table"
2550 WIDTH="100%"
2551 BORDER="0"
2552 CELLPADDING="0"
2553 CELLSPACING="0"
2554 ><TR
2555 ><TD
2556 WIDTH="33%"
2557 ALIGN="left"
2558 VALIGN="top"
2559 ><A
2560 HREF="documentation.html"
2561 ACCESSKEY="P"
2562 >Prev</A
2563 ></TD
2564 ><TD
2565 WIDTH="34%"
2566 ALIGN="center"
2567 VALIGN="top"
2568 ><A
2569 HREF="index.html"
2570 ACCESSKEY="H"
2571 >Home</A
2572 ></TD
2573 ><TD
2574 WIDTH="33%"
2575 ALIGN="right"
2576 VALIGN="top"
2577 ><A
2578 HREF="testing.html"
2579 ACCESSKEY="N"
2580 >Next</A
2581 ></TD
2582 ></TR
2583 ><TR
2584 ><TD
2585 WIDTH="33%"
2586 ALIGN="left"
2587 VALIGN="top"
2588 >Documentation Guidelines</TD
2589 ><TD
2590 WIDTH="34%"
2591 ALIGN="center"
2592 VALIGN="top"
2593 >&nbsp;</TD
2594 ><TD
2595 WIDTH="33%"
2596 ALIGN="right"
2597 VALIGN="top"
2598 >Testing Guidelines</TD
2599 ></TR
2600 ></TABLE
2601 ></DIV
2602 ></BODY
2603 ></HTML
2604 >