-
Notifications
You must be signed in to change notification settings - Fork 10
CodingStandards
Karl Ramm edited this page Jan 20, 2013
·
5 revisions
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 */
(casts *)hug_the_cast_identifier(spaces, after, commas);
{| border=1 class="simple"
! operators;
|}
}
return unparenthesized_expression;
}
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.
ALSO RANDOM TRAILING WHITESPACE MAKES CODER ANGRY. YOU NOT LIKE CODER WHEN CODER ANGRY. CODER SMASH.