home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / STYLE.C < prev    next >
Text File  |  1997-07-05  |  2KB  |  38 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /***************************************************************************/
  4. /*  Global (public) headers look like this                                 */
  5. /*                                                                         */
  6. /*  foo()                                                                  */
  7. /*  Parameters: description of each passed datum                           */
  8. /*  Returns: description of return value & significance                    */
  9. /*  Side effects: complete details                                         */
  10. /*  Notes: extra info                                                      */
  11. /***************************************************************************/
  12.  
  13. /*
  14. ** Static (local) headers look like this
  15. **
  16. ** Brief description
  17. */
  18.  
  19. int foo(void)   /* use ANSI prototypes on every compiler that supports 'em */
  20. {
  21.       /* First of all, block comments (like this one) are preferable to    */
  22.       /* trailing (in-line) comments as in the following examples.         */
  23.  
  24.       int local1, local2;               /* local variable declarations are
  25.                                            always followed by a blank line */
  26.  
  27.       do_stuff();
  28.       if (bar(local1))
  29.       {     /* long comments here     *//* this lines up with -----------+ */
  30.             char *local3;               /* autos declared close to use   | */
  31.                                         /*                               | */
  32.             do_more_stuff();            /* (everything else indented)    | */
  33.             local2 = strlen(local3);    /*                               | */
  34.       }                                 /* this <------------------------+ */
  35.       else  local2 = fubar();           /* using tab >= 6, else's line up  */
  36.       return local2;
  37. }                                       /* no question where functions end!*/
  38.