Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

Changes between Version 1 and Version 2 of StyleGuide


Ignore:
Timestamp:
May 21, 2008, 5:00:33 PM (16 years ago)
Author:
resiak
Comment:

Distill some style discussions from devel@cpi into the guidelines.

Legend:

Unmodified
Added
Removed
Modified
  • StyleGuide

    v1 v2  
    11= Coding Standards =
    22
    3 We try to follow K&R coding style in most of or code. Here are some examples to help explain:
     3We try to follow K&R coding style in most of our code.  Some existing code violates these standards.  If you are writing a patch against some such code, please do fix violations in that block of code --- but don't reformat entire files!
     4
     5Here are some examples to help explain the intended style:
    46
    57== Braces ==
     
    3840== Comments ==
    3941 * A comment or two in the static (non-exported) functions is good, but not essential.
    40  * Every function added in any header file must be documented. See any of the header files in our tree for example.
     42 * Every function added in any header file must be documented. See any of the header files in our tree for example. (If you find an undocumented or poorly documented function, please do submit a patch fixing it!)
     43 * Only use C89 comments, not C++/C99 one-line comments:
     44
     45{{{
     46#!c
     47// this kind of comment is not supported in C89, so cannot be used in our codebase.
     48
     49/* Use this kind of comment for a single line... */
     50
     51/* And if you have a comment spanning multiple lines,
     52 * have a neat column of stars to the left!
     53 */
     54}}}
     55
     56== Function Definitions ==
     57
     58 * There should be a newline between the return type of the function and the function's name.
     59 * One parameter per line.
     60 * As mentioned above, the opening brace should be on a new line.
     61
     62For example:
     63
     64{{{
     65#!c
     66GtkWidget *
     67do_some_magic_thing(int foo,
     68                    gchar *bar)
     69{
     70        /* misc, other */
     71}
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!