Skip to content
Karl Ramm edited this page Apr 21, 2009 · 5 revisions

CodingStandards

4 character indentation quantum, please use spaces and not tabs. If you must have tabs, they have 8-characters stops. Put spaces before and after operators that aren't english punctuation; . , () follow normal writing rules. (I know what I mean, I might be missing some cases in an attempt to be clever.) In general, you have this big wide thing at the bottom of your keyboard for a reason.

return_type_on_line_before_function
functionname(short arglist) 
{
    if (condition) {
        /* braces on the line with the control statement */
    }
}

return_type *
otherfunction(long arglist,
              split among,
              several lines)
{
}

In general, if you can avoid using the C preprocessor, do so. enum makes a reasonable substitute for #defined constants, and if your compiler isn't clever about inline functions, get a better compiler.

Clone this wiki locally