dd102c017ca3ced9459c3dbfabd5740693214ca2
[privoxy.git] / doc / STANDARDS.txt
1 @ Introduction
2
3
4 This set of standards is designed to make our lives easier. It is
5 developed with the simple goal of helping us keep the "new and
6 improved Junkbusters" consistent and reliable.  Thus making
7 maintenance easier and increasing chances of success of the
8 project.
9
10 And that of course comes back to us as individuals. If we can
11 increase our development and product efficiencies then we can
12 solve more of the request for changes/improvements and in general 
13 feel good about ourselves.  ;->
14
15
16 @ Using Comments
17
18
19 @@ Comment, Comment, Comment
20
21 @@@ Explanation:
22
23 Comment as much as possible without commenting the obvious.  For
24 example do not comment "aVariable is equal to bVariable".  Instead
25 explain why aVariable should be equal to the bVariable.  Just
26 because a person can read code does not mean they will understand
27 why or what is being done.  A reader may spend a lot more time
28 figuring out what is going on when a simple comment or explanation
29 would have prevented the extra research.  Please help your brother
30 IJB'ers out!
31
32 The comments will also help justify the intent of the code.  If the
33 comment describes something different than what the code is doing
34 then maybe a programming error is occurring.
35
36 @@@ Example:
37
38 /* if page size greater than 1k ... */
39 if ( PageLength() > 1024 )
40 {
41     ... "block" the page up ...
42 }
43
44 /* if page size is small, send it in blocks */
45 if ( PageLength() > 1024 )
46 {
47     ... "block" the page up ...
48 }
49
50 This demonstrates 2 cases of "what not to do".  The first is a
51 "syntax comment".  The second is a comment that does not fit what
52 is actually being done.
53
54
55 @@ Use blocks for comments
56
57 @@@ Explanation:
58
59 Comments can help or they can clutter.  They help when they are
60 differentiated from the code they describe.  One line comments do
61 not offer effective separation between the comment and the code.
62 Block identifiers do, by surrounding the code with a clear,
63 definable pattern.
64
65 @@@ Example:
66
67 /*********************************************************************
68  * This will stand out clearly in your code!
69  *********************************************************************/
70 if ( thisVariable == thatVariable )
71 {
72    DoSomethingVeryImportant();
73 }
74
75
76 /* unfortunately, this may not */
77 if ( thisVariable == thatVariable )
78 {
79    DoSomethingVeryImportant();
80 }
81
82
83 if ( thisVariable == thatVariable ) /* this may not either */
84 {
85    DoSomethingVeryImportant();
86 }
87
88 @@@ Exception:
89
90 If you are trying to add a small logic comment and do not wish to
91 "disrubt" the flow of the code, feel free to use a 1 line comment
92 which is NOT on the same line as the code.
93
94
95 @@ Keep Comments on their own line
96
97 @@@ Explanation:
98
99 It goes back to the question of readability.  If the comment is on
100 the same line as the code it will be harder to read than the
101 comment that is on its own line.
102
103 There are three exceptions to this rule, which should be violated
104 freely and often: during the definition of variables, at the end
105 of closing braces, when used to comment parameters.
106
107 @@@ Example:
108
109 /*********************************************************************
110  * This will stand out clearly in your code,
111  * But the second example won't.
112  *********************************************************************/
113 if ( thisVariable == thatVariable )
114 {
115    DoSomethingVeryImportant();
116 }
117
118 if ( thisVariable == thatVariable ) /*can you see me?*/
119 {
120    DoSomethingVeryImportant(); /*not easily*/
121 }
122
123
124 /*********************************************************************
125  * But, the encouraged exceptions:
126  *********************************************************************/
127 int urls_read     = 0;     /* # of urls read + rejected */
128 int urls_rejected = 0;     /* # of urls rejected */
129
130 if ( 1 == X )
131 {
132    DoSomethingVeryImportant();
133 }
134
135
136 short DoSomethingVeryImportant(
137    short firstParam,   /* represents something */
138    short nextParam     /* represents something else */ )
139 {
140    ...code here...
141
142 }   /* -END- DoSomethingVeryImportant */
143
144
145 @@ Comment each logical step
146
147 @@@ Explanation:
148
149 Logical steps should be commented to help others follow the
150 intent of the written code and comments will make the code more
151 readable.
152
153 If you have 25 lines of code without a comment, you should
154 probably go back into it to see where you forgot to put one.
155
156 Most "for", "while", "do", etc... loops _probably_ need a
157 comment.  After all, these are usually major logic containers.
158
159
160 @@ Comment All Functions Thoroughly
161
162 @@@ Explanation:
163
164 A reader of the code should be able to look at the comments just
165 prior to the beginning of a function and discern the reason for
166 its existence and the consequences of using it.  The reader
167 should not have to read through the code to determine if a given
168 function is safe for a desired use.  The proper information
169 thoroughly presented at the introduction of a function not only
170 saves time for subsequent maintenance or debugging, it more
171 importantly aids in code reuse by allowing a user to determine
172 the safety and applicability of any function for the problem at
173 hand.  As a result of such benefits, all functions should contain
174 the information presented in the addendum section of this
175 document.
176
177
178 @@ Comment at the end of braces if the content is more than one screen length
179
180 @@@ Explanation:
181
182 Each closing brace should be followed on the same line by a
183 comment that describes the origination of the brace if the
184 original brace is off of the screen, or otherwise far away from
185 the closing brace.  This will simplify the debugging, maintenance,
186 and readability of the code.
187
188 As a suggestion , use the following flags to make the comment and
189 its brace more readable:
190
191 use following a closing brace:
192    } /* -END- if() or while () or etc... */
193
194 @@@ Example:
195
196 if ( 1 == X )
197 {
198    DoSomethingVeryImportant();
199    ...some long list of commands...
200 } /* -END- if x is 1 */
201
202 or:
203
204 if ( 1 == X )
205 {
206    DoSomethingVeryImportant();
207    ...some long list of commands...
208 } /* -END- if ( 1 == X ) */
209
210
211 @ Naming Conventions
212
213
214 @@ Variable Names
215
216 @@@ Explanation:
217
218 Capitalize the first letter of each word in a variable name
219 except the first word.
220
221 @@@ Example:
222
223 int msIis5Hack = 0;
224
225 @@@ Instead of:
226
227 int ms_iis5_hack = 0;
228
229 @@@ Note: This is not an "enforcable" issue since too much of IJB uses
230 the underscore (_) to seperate words.
231
232 @@@ Status: developer-discrection.  This item is at developer
233 discrection and is currently open to debate by the IJB developer team.
234 Too much of IJB violates this proposed standard.
235
236
237 @@ Function Names
238
239 @@@ Explanation:
240
241 Capitalize the first letter of each word in a function name.
242
243 @@@ Example:
244
245 int loadAclFile( struct client_state *csp )
246
247 @@@ Instead of:
248
249 int load_aclfile( struct client_state *csp )
250
251 @@@ Status: developer-discrection.  This item is at developer
252 discrection and is currently open to debate by the IJB developer team.
253 Too much of IJB violates this proposed standard.
254
255 @@@ Note: on the 2 above "standards" ... if enough of the current
256 developer team agrees, I can use XEmacs to apply a few regular
257 expressions to make the current tree comply with these 2 points.
258 Otherwise I will remove them from this document.  Afterall, there is
259 no need to add to the "multiple personallity" syndrome that IJB now
260 has (or recently had before standardization).
261
262
263 @@ Header file prototypes
264
265 @@@ Explanation:
266
267 Use a descriptive parameter name in the function prototype in
268 header files.  Use the same parameter name in the header file
269 that you use in the c file.
270
271 @@@ Example:
272
273 (.h) extern int load_aclfile( struct client_state *csp );
274 (.c) int load_aclfile( struct client_state *csp )
275
276 @@@ Instead of:
277 (.h) extern int load_aclfile( struct client_state * );   or
278 (.h) extern int load_aclfile();
279 (.c) int load_aclfile( struct client_state *csp )
280
281
282 18.  Ennumerations, and #defines
283
284 @@@ Explanation:
285
286 Use all capital letters, with underscores between words.
287
288 @@@ Example:
289
290 (enumeration) : enum Boolean { FALSE, TRUE };
291 (#define) : #define DEFAULT_SIZE 100;
292
293 @@@ Note: We should have a standard naming scheme for Symbols that
294 toggle a feature in the precompiler, and the constants used by that
295 feature. I'd propose that the toggles should be just one word, with
296 a common prefix, and that any depandant constants should be
297 prefixed by that word.
298
299 The prefix could be WITH_, HAVE_, ENABLE_, FEATURE_ etc.
300
301 @@@ Status: I see some this in the code currently!  Anybody "figured"
302 out a standard way to do this?
303
304 @@@ Example:
305
306 #define ENABLE_FORCE 1
307
308 #ifdef ENABLE_FORCE
309 #define FORCE_PREFIX blah
310 #endif /* def ENABLE_FORCE */
311
312
313 @@ Constants
314
315 @@@ Explanation:
316
317 Spell common words out entirely (do not remove vowels).
318
319 Use only widely-known domain acronyms and abbreviations.  Capitalize
320 all letters of an acronym.
321
322 Use underscore (_) to separate adjacent acronyms and
323 abbreviations.  Never terminate a name with an underscore.
324
325 @@@ Example:
326
327 #define USE_IMAGE_LIST 1
328
329 @@@ Instead of:
330
331 #define USE_IMG_LST 1       or
332 #define _USE_IMAGE_LIST 1   or
333 #define USE_IMAGE_LIST_ 1   or
334 #define use_image_list  1   or
335 #define UseImageList    1
336
337
338 @ Using Space
339
340
341 @@ Put braces on a line by themselves.
342
343 @@@ Explanation:
344
345 The brace needs to be on a line all by itself, not at the end of
346 the statement.  Curly braces should line up with the construct
347 that they're associated with.  This practice makes it easier to
348 identify the opening and closing braces for a block.
349
350 @@@ Example:
351
352 if ( this == that )
353 {
354    ...
355 }
356
357 @@@ Instead of:
358
359 if ( this == that ) {
360    ...
361 }
362
363 or
364
365 if ( this == that ) { ...  }
366
367 @@@ Note: In the special case that the if-statement is inside a loop,
368 and it is trivial, i.e. it tests for a condidtion that is obvious
369 from the purpose of the block, one-liners as above may optically
370 preserve the loop structure and make it easier to read.
371
372 @@@ Status: developer-discrection.
373
374 @@@ Example exception:
375
376 while ( more lines are read )
377 {
378    /* Please document what is/is not a comment line here */
379    if ( it's a comment ) continue;
380
381    do_something( line );
382 }
383
384
385 @@ ALL control statements should have a block
386
387 @@@ Explanation:
388
389 Using braces to make a block will make your code more readable
390 and less prone to error.  All control statements should have a
391 block defined.
392
393 @@@ Example:
394
395 if ( this == that )
396 {
397    DoSomething();
398    DoSomethingElse();
399 }
400
401 @@@ Instead of:
402
403 if ( this == that )
404    DoSomething();
405    DoSomethingElse();
406
407 or
408
409 if ( this == that ) DoSomething();
410
411 @@@ Note: The first example in "Instead of" will execute in a manner
412 other than that which the developer desired (per indentation).  Using
413 code braces would have prevented this "feature".  The "explanation"
414 and "exception" from the point above also applies.
415
416
417 @@ Do not belabor/blow-up boolean expressions
418
419 @@@ Example:
420
421 structure->flag = ( condition );
422
423 @@@ Instead of:
424
425 if ( condition )
426 {
427    structure->flag = 1;
428 }
429 else
430 {
431    structure->flag = 0;
432 }
433
434 @@@ Note: The former is readable and consice.  The later is wordy and
435 inefficient.  Please assume that any developer new to the project has
436 at least a "good" knowledge of C/C++.  (Hope I do not offend by that
437 last comment ... 8-)
438
439
440 @@ Use white space freely because it is free
441
442 @@@ Explanation:
443
444 Make it readable.  The notable exception to using white space
445 freely is listed in the next guideline.
446
447 @@@ Example:
448
449 int firstValue   = 0;
450 int someValue    = 0;
451 int anotherValue = 0;
452 int thisVariable = 0;
453
454 if ( thisVariable == thatVariable )
455
456 firstValue = oldValue + ( ( someValue - anotherValue ) - whatever )
457
458
459 @@ Don't use white space around structure operators
460
461 @@@ Explanation:
462
463 - structure pointer operator ( "->" ) 
464 - member operator ( "." )
465 - functions and parentheses
466
467 It is a general coding practice to put pointers, references, and
468 function parentheses next to names.  With spaces, the connection
469 between the object and variable/function name is not as clear.
470
471 @@@ Example:
472
473 aStruct->aMember;
474 aStruct.aMember;
475 FunctionName();
476
477 @@@ Instead of:
478 aStruct -> aMember;
479 aStruct .  aMember;
480 FunctionName ();
481
482
483 @@ Make the last brace of a function stand out
484
485 @@@ Example:
486
487 int function1( ... )
488 {
489    ...code...
490    return( retCode );
491
492 }   /* -END- function1 */
493
494
495 int function2( ... )
496 {
497 }   /* -END- function2 */
498
499
500 @@@ Instead of:
501
502 int function1( ... )
503 {
504    ...code...
505    return( retCode );
506 }
507 int function2( ... )
508 {
509 }
510
511 @@@ Note: Use 1 blank line before the closing brace and 2 lines
512 afterwards.  This makes the end of function standout to the most
513 casual viewer.  Although function comments help seperate functions,
514 this is still a good coding practice.  In fact, I follow these rules
515 when using blocks in "for", "while", "do" loops, and long if {}
516 statements too.  After all whitespace is free!
517
518 @@@ Status: developer-discrection on the number of blank lines.
519 Enforced is the end of function comments.
520
521
522 @@ Use 3 character indentions
523
524 @@@ Explanation:
525
526 If some use 8 character TABs and some use 3 character TABs, the code
527 can look *very* ragged.  So use 3 character indentions only.  If you
528 like to use TABs, pass your code through a filter such as "expand -t3"
529 before checking in your code.
530
531 @@@ Example:
532
533 static const char * const url_code_map[256] =
534 {
535    NULL, ...
536 };
537
538
539 int function1( ... )
540 {
541    if ( 1 )
542    {
543       return( ALWAYS_TRUE );
544    }
545    else
546    {
547       return( HOW_DID_YOU_GET_HERE );
548    }
549
550    return( NEVER_GETS_HERE );
551
552 }
553
554
555 @ Initializing
556
557
558 @@ Initialize all variables
559
560 @@@ Explanation:
561
562 Do not assume that the variables declared will not be used until
563 after they have been assigned a value somewhere else in the
564 code.  Remove the chance of accidentally using an unassigned
565 variable.
566
567 @@@ Example:
568
569 short anShort = 0;
570 float aFloat  = 0;
571 struct *ptr = NULL;
572
573 @@@ Note: It is much easier to debug a SIGSEGV if the message says
574 you are trying to access memory address 00000000 and not
575 129FA012; or arrayPtr[20] causes a SIGSEV vs. arrayPtr[0].
576
577 @@@ Status: developer-discrection if and only if the variable is
578 assigned a value "shortly after" declaration.
579
580
581 @ Functions
582
583
584 @@ Name functions that return a boolean as a question.
585
586 @@@ Explanation:
587
588 Value should be phrased as a question that would logically be
589 answered as a true or false statement
590
591 @@@ Example:
592
593 ShouldWeBlockThis();
594 ContainsAnImage();
595 IsWebPageBlank();
596
597
598 @@ Always specify a return type for a function.
599
600 @@@ Explanation:
601
602 The default return for a function is an int.  To avoid ambiguity,
603 create a return for a function when the return has a purpose, and
604 create a void return type if the function does not need to return
605 anything.
606
607
608 @@ Minimize function calls when iterating by using variables
609
610 @@@ Explanation:
611
612 It is easy to write the following code, and a clear argument can
613 be made that the code is easy to understand:
614
615 @@@ Example:
616
617 for ( size_t cnt = 0; cnt < blockListLength(); cnt ++ )
618 {
619    ....
620 }
621
622 @@@ Note: Unfortunately, this makes a function call for each and every
623 iteration.  This increases the overhead in the program, because the
624 compiler has to look up the function each time, call it, and return a
625 value.  Depending on what occurs in the blockListLength() call, it
626 might even be creating and destroying structures with each iteration,
627 even though in each case it is comparing "cnt" to the same value, over
628 and over.  Remember too - even a call to blockListLength() is a
629 function call, with the same overhead.
630
631 Instead of using a function call during the iterations, assign
632 the value to a variable, and evaluate using the variable.
633
634 @@@ Example:
635
636 size_t len = blockListLength();
637
638 for ( size_t cnt = 0; cnt < len; cnt ++ )
639 {
640    ....
641 }
642
643 @@@ Exceptions: if the value of blockListLength() *may* change or could
644 *potentially* change, then you must code the function call in the
645 for/while loop.
646
647
648 @@ Pass and Return by Const Reference
649
650 @@@ Explanation:
651
652 This allows a developer to define a const pointer and call your
653 function.  If your function does not have the const keyword, we
654 may not be able to use your function.  Consider strcmp, if it
655 were defined as:
656    extern int strcmp( char *s1, char *s2 );
657
658 I could then not use it to compare argv's in main:
659    int main( int argc, const char *argv[] )
660    {
661      strcmp( argv[0], "junkbusters" );
662    }
663
664 Both these pointers are *const*!  If the c runtime library maintainers
665 do it, we should too.
666
667
668 @@ Pass and Return by Value
669
670 @@@ Explanation:
671
672 Most structures cannot fit onto a normal stack entry (i.e. they
673 are not 4 bytes or less).  Aka, a function declaration like:
674    int load_aclfile( struct client_state csp )
675
676 would not work.  So, to be consistent, we should declare all
677 prototypes with "pass by value":
678    int load_aclfile( struct client_state *csp )
679
680
681 @@ Use #include <fileName> and #include "fileName" for locals
682
683 @@@ Explanation:
684
685 Your include statements should contain the file name without a
686 path.  The path should be listed in the Makefile, using -I as
687 processor directive to search the indicated paths.  An exception
688 to this would be for some proprietary software that utilizes a
689 partial path to distinguish their header files from system or
690 other header files.
691
692 @@@ Example:
693
694 #include <iostream.h>     /* This is not a local include */
695 #include "config.h"       /* This IS a local include */
696
697 @@@ Exception:
698
699 /* This is not a local include, but requires a path element. */
700 #include <sys/fileName.h>
701
702 @@@ Note: Please! do not add "-I." to the Makefile without a _very_
703 good reason.  This duplicates the #include "file.h" behaviour.
704
705
706 @@ Provide multiple inclusion protection
707
708 @@@ Explanation:
709
710 Prevents compiler and linker errors resulting from redefinition of
711 items.
712
713 Wrap each header file with the following syntax to prevent multiple
714 inclusions of the file.  Of course, replace FILENAME_UPPERCASE with
715 your file name, with "." Changed to "_", and make it uppercase.
716
717 @@@ Example:
718
719 #ifndef _PROJECT_H
720 #define _PROJECT_H
721    ...
722 #endif /* ndef _PROJECT_H */
723
724
725 @@ Where Possible, Use Forward Struct Declaration Instead of Includes
726
727 @@@ Explanation:
728
729 Useful in headers that include pointers to other struct's.
730 Modifications to excess header files may cause needless compiles.
731
732 @@@ Example:
733
734 /*********************************************************************
735  * We're avoiding an include statement here!
736  *********************************************************************/
737 struct file_list;
738 extern file_list *xyz;
739
740 @@@ Note: If you declare "file_list xyz;" (without the pointer), then
741 including the proper header file is necessary.  If you only want to
742 prototype a pointer, however, the header file is unneccessary.
743
744 @@@ Status: Use with discrection.
745
746
747 @ General Coding Practices
748
749
750 @@ Provide a default case for all switch statements
751
752 @@@ Explanation:
753
754 What you think is guaranteed is never really guaranteed.  The value
755 that you don't think you need to check is the one that someday will be
756 passed.  So, to protect yourself from the unknown, always have a
757 default step in a switch statement.
758
759 @@@ Example:
760
761 switch( hash_string( cmd ) )
762 {
763    case hash_actions_file :
764       ... code ...
765       break;
766
767    case hash_confdir :
768       ... code ...
769       break;
770
771    default :
772       log_error( ... );
773       ... anomly code goes here ...
774       continue; / break; / exit( 1 ); / etc ...
775
776 } /* end switch( hash_string( cmd ) ) */
777
778 @@@ Note: If you already have a default condition, you are obviously
779 exempt from this point.  Of note, most of the WIN32 code calls
780 `DefWindowProc' after the switch statement.  This API call
781 *should* be included in a default statement.
782
783 @@@ Another Note: This is not so much a readability issue as a robust
784 programming issue.  The "anomly code goes here" may be no more than a
785 print to the STDERR stream (as in load_config).  Or it may really be
786 an ABEND condition.
787
788 @@@ Status: Programmer discretion is advised.
789
790
791 @@ Try to avoid falling through cases in a switch statement.
792
793 @@@ Explanation:
794
795 In general, you will want to have a 'break' statement within each
796 'case' of a switch statement.  This allows for the code to be more
797 readable and understandable, and furthermore can prevent unwanted
798 surprises if someone else later gets creative and moves the code
799 around.
800
801 The language allows you to plan the fall through from one case
802 statement to another simply by omitting the break statement within the
803 case statement.  This feature does have benefits, but should only be
804 used in rare cases.  In general, use a break statement for each case
805 statement.
806
807 If you choose to allow fall through, you should comment both the fact
808 of the fall through and reason why you felt it was necessary.
809
810
811 @@ Use 'long' or 'short' Instead of 'int'
812
813 @@@ Explanation:
814
815 On 32-bit platforms, int usually has the range of long.  On 16-bit
816 platforms, int has the range of short.
817
818 @@@ Status: open-to-debate.  In the case of most FSF projects
819 (including X/GNU-Emacs), there are typedefs to int4, int8, int16, (or
820 equivalence ... I forget the exact typedefs now).  Should we add these
821 to IJB now that we have a "configure" script?
822
823
824 @@ Declare each variable and struct on its own line.
825
826 @@@ Explanation:
827
828 It can be tempting to declare a series of variables all on one line.
829 Don't.
830
831 @@@ Example:
832
833 long a = 0;
834 long b = 0;
835 long c = 0;
836
837 @@@ Instead of:
838
839 long a, b, c;
840
841 @@@ Explanation:
842 - there is more room for comments on the individual variables
843 - easier to add new variables without messing up the original ones
844 - when searching on a variable to find its type, there is less
845   clutter to "visually" eliminate
846
847 @@@ Exceptions: when you want to declare a bunch of loop variables or
848 other trivial variables; feel free to declare them on 1 line.  You
849 should, although, provide a good comment on their functions.
850
851 @@@ Status: developer-discrection.
852
853
854 @@ Use malloc/zalloc sparingly
855
856 @@@ Explanation:
857
858 Create a local stuct (on the stack) if the variable will live
859 and die within the context of one function call.
860
861 Only "malloc" a struct (on the heap) if the variable's life will
862 extend beyond the context of one function call.
863
864 @@@ Example:
865
866 If a function creates a struct and stores a pointer to it in a
867 list, then it should definately be allocated via `malloc'.
868
869
870 @@ The Programmer Who Uses 'malloc' is Responsible for Ensuring 'free'
871
872 @@@ Explanation:
873
874 If you have to "malloc" an instance, you are responsible for insuring
875 that the instance is `free'd, even if the deallocation event falls
876 within some other programmer's code.  You are also responsible for
877 ensuring that deletion is timely (i.e. not too soon, not too late).
878 This is known as "low-coupling" and is a "good thing (tm)".  You may
879 need to offer a free/unload/destuctor type function to accomodate
880 this.
881
882 @@@ Example:
883
884 int load_re_filterfile( struct client_state *csp ) { ... }
885 static void unload_re_filterfile( void *f ) { ... }
886
887 @@@ Exceptions:
888
889 The developer cannot be expected to provide `free'ing functions for 
890 C run-time library functions ... such as `strdup'.
891
892 @@@ Status: developer-discrection.  The "main" use of this standard is
893 for allocating and freeing data structures (complex or nested).
894
895
896 @@ Add loaders to the `file_list' structure and in order
897
898 @@@ Explanation:
899
900 I have ordered all of the "blocker" file code to be in alpha
901 order.  It is easier to add/read new blockers when you expect a
902 certain order.
903
904 @@@ Note: It may appear that the alpha order is broken in places by
905 POPUP tests coming before PCRS tests.  But since POPUPs can also
906 be referred to as KILLPOPUPs, it is clear that it should come
907 first.
908
909
910 @@ "Uncertain" new code and/or changes to exitinst code, use FIXME
911
912 @@@ Explanation:
913
914 If you have enough confidence in new code or confidence in your
915 changes, but are not *quite* sure of the reprocussions, add this:
916
917 /* FIXME: this code has a logic error on platform XYZ,
918  * attempthing to fix
919  */
920 #ifdef PLATFORM
921    ...changed code here...
922 #endif
923
924 or:
925
926 /* FIXME: I think the original author really meant this... */
927    ...changed code here...
928
929 or:
930
931 /* FIXME: new code that *may* break something else... */
932    ...new code here...
933
934 @@@ Note: If you make it clear that this may or may not be a "good
935 thing (tm)", it will be easier to identify and include in the project
936 (or conversly exclude from the project).
937
938
939 @ Addendum: Template for files and function comment blocks:
940
941
942 @@@ Example for file comments:
943
944 const char FILENAME_rcs[] = "$Id: STANDARDS.txt,v 1.2 2001/06/28 04:02:42 iwanttokeepanon Exp $";
945 /*********************************************************************
946  *
947  * File        :  $Source: /cvsroot/ijbswa/current/doc/STANDARDS.txt,v $
948  *
949  * Purpose     :  (Fill me in with a good description!)
950  *
951  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
952  *                IJBSWA team.  http://ijbswa.sourceforge.net
953  *
954  *                Based on the Internet Junkbuster originally written
955  *                by and Copyright (C) 1997 Anonymous Coders and 
956  *                Junkbusters Corporation.  http://www.junkbusters.com
957  *
958  *                This program is free software; you can redistribute it 
959  *                and/or modify it under the terms of the GNU General
960  *                Public License as published by the Free Software
961  *                Foundation; either version 2 of the License, or (at
962  *                your option) any later version.
963  *
964  *                This program is distributed in the hope that it will
965  *                be useful, but WITHOUT ANY WARRANTY; without even the
966  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
967  *                PARTICULAR PURPOSE.  See the GNU General Public
968  *                License for more details.
969  *
970  *                The GNU General Public License should be included with
971  *                this file.  If not, you can view it at
972  *                http://www.gnu.org/copyleft/gpl.html
973  *                or write to the Free Software Foundation, Inc., 59
974  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
975  *
976  * Revisions   :
977  *    $Log: STANDARDS.txt,v $
978  *    Revision 1.2  2001/06/28 04:02:42  iwanttokeepanon
979  *    Testing XEmacs and VC/CVS modes.  Will this work?   We shall see...
980  *
981  *    Revision 1.1  2001/06/28 03:01:32  iwanttokeepanon
982  *    A suggested standard for IJB.  Outline-mode formatting and spell checking to follow.  Developer comments encouraged and requested.
983  *
984  *
985  *********************************************************************/
986 \f
987
988 #include "config.h"
989
990    ...necessary include files for us to do our work...
991
992 const char FILENAME_h_rcs[] = FILENAME_H_VERSION;
993
994
995 @@@ Note: This declares the rcs variables that should be added to the
996 "show-proxy-args" page.  If this is a brand new creation by you, you
997 are free to change the "Copyright" section to represent the rights you
998 wish to maintain.
999
1000 @@@ Note: The formfeed character that is present right after the
1001 comment flower box is handy for (X|GNU)Emacs users to skip the verbige
1002 and get to the heart of the code (via `forward-page' and
1003 `backward-page').  Please include it if you can.
1004
1005 @@@ Example for file header comments:
1006
1007 #ifndef _FILENAME_H
1008 #define _FILENAME_H
1009 #define FILENAME_H_VERSION "$Id: STANDARDS.txt,v 1.2 2001/06/28 04:02:42 iwanttokeepanon Exp $"
1010 /*********************************************************************
1011  *
1012  * File        :  $Source: /cvsroot/ijbswa/current/doc/STANDARDS.txt,v $
1013  *
1014  * Purpose     :  (Fill me in with a good description!)
1015  *
1016  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1017  *                IJBSWA team.  http://ijbswa.sourceforge.net
1018  *
1019  *                Based on the Internet Junkbuster originally written
1020  *                by and Copyright (C) 1997 Anonymous Coders and 
1021  *                Junkbusters Corporation.  http://www.junkbusters.com
1022  *
1023  *                This program is free software; you can redistribute it 
1024  *                and/or modify it under the terms of the GNU General
1025  *                Public License as published by the Free Software
1026  *                Foundation; either version 2 of the License, or (at
1027  *                your option) any later version.
1028  *
1029  *                This program is distributed in the hope that it will
1030  *                be useful, but WITHOUT ANY WARRANTY; without even the
1031  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1032  *                PARTICULAR PURPOSE.  See the GNU General Public
1033  *                License for more details.
1034  *
1035  *                The GNU General Public License should be included with
1036  *                this file.  If not, you can view it at
1037  *                http://www.gnu.org/copyleft/gpl.html
1038  *                or write to the Free Software Foundation, Inc., 59
1039  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1040  *
1041  * Revisions   :
1042  *    $Log: STANDARDS.txt,v $
1043  *    Revision 1.2  2001/06/28 04:02:42  iwanttokeepanon
1044  *    Testing XEmacs and VC/CVS modes.  Will this work?   We shall see...
1045  *
1046  *    Revision 1.1  2001/06/28 03:01:32  iwanttokeepanon
1047  *    A suggested standard for IJB.  Outline-mode formatting and spell checking to follow.  Developer comments encouraged and requested.
1048  *
1049  *
1050  *********************************************************************/
1051 \f
1052
1053 #include "project.h"
1054
1055 #ifdef __cplusplus
1056 extern "C" {
1057 #endif
1058
1059    ... function headers here ...
1060
1061
1062 /* Revision control strings from this header and associated .c file */
1063 extern const char FILENAME_rcs[];
1064 extern const char FILENAME_h_rcs[];
1065
1066
1067 #ifdef __cplusplus
1068 } /* extern "C" */
1069 #endif
1070
1071 #endif /* ndef _FILENAME_H */
1072
1073 /*
1074   Local Variables:
1075   tab-width: 3
1076   end:
1077 */
1078
1079
1080 @@@ Example for function comments:
1081
1082 /*********************************************************************
1083  *
1084  * Function    :  FUNCTION_NAME
1085  *
1086  * Description :  (Fill me in with a good description!)
1087  *
1088  * Parameters  :
1089  *          1  :  param1 = pointer to an important thing
1090  *          2  :  x      = pointer to something else
1091  *
1092  * Returns     :  0 => Ok, everything else is an error.
1093  *
1094  *********************************************************************/
1095 int FUNCTION_NAME( void *param1, const char *x )
1096 {
1097    ...
1098    return( 0 );
1099
1100 }
1101
1102
1103 @@@ Note: If we all follow this practice, we should be able to parse
1104 our code to create a "self-documenting" web page.
1105
1106
1107 @ Local variables for this standards file
1108
1109
1110 \f
1111 Local variables:
1112 mode: outline
1113 mode: auto-fill
1114 outline-regexp: "[@]+"
1115 tab-width: 3
1116 End: