Make Dt match installed file name.
[netbsd-mini2440.git] / dist / ipf / STYLE.TXT
blob384bcec3d9094d05af536369e5861b88f94078c1
2 Over time, I am moving all of the IPFilter code to what I consider a better
3 coding style than it had before.  If you submit patches, I expect them to
4 conform as appropriate.
6 Function Comments
7 =================
8 Preceeding each and every function, a comment block like this should
9 be present:
11 /* ------------------------------------------------------------------------ */
12 /* Function:    function-name                                               */
13 /* Returns:     return-type                                                 */
14 /* Parameters:  param1(I) - param1 is an input parameter                    */
15 /*              p2(O)     - p2 is an output parameter passed as an arg      */
16 /*              par3(IO)  - par3 is a parameter which is both input and     */
17 /*                          output.  Pointers to things which are used and  */
18 /*                          then get a result stored in them qualify here.  */
19 /*                                                                          */
20 /* Description about what the function does.  This comment should explain   */
21 /* any gotchas or algorithms that are used which aren't obvious to the      */
22 /* casual reader.  It should not be an excuse to not use comments inside    */
23 /* the function.                                                            */
24 /* ------------------------------------------------------------------------ */
27 Tab spacing
28 ===========
29 Tabs are to be at 8 characters.
32 Conditions
33 ==========
34 All expressions which evaluate to a boolean for a test condition, such as
35 in an if()/while() statement must involve a boolean operation.  Since C
36 has no native boolean type, this means that one of <,>,<=,>=,==,!= must
37 be present.  Implied boolean evaluations are out.
39 In code, the following is banned:
41 if (x)
42 if (!x)
43 while ((a = b))
45 and should be replaced by:
47 if (x != 0)
48 if (x == 0)
49 while ((a = b) != 0)
51 If pointers are involved, always compare with NULL, ie.:
53 if (x != NULL)
54 if (x == NULL)
55 while ((a = b) != NULL)