- 4 space tab size
- always have newlines before open brackets
instead of
if (cond) { do something do another thing }if (cond) { do something do another thing }- however, avoid using brackets for a single line of code
or
if (cond) do somethinginstead ofif (cond) do somethingif (cond) { do something }
- however, avoid using brackets for a single line of code
- no increase of nesting level at case statements
- variable declarations allowed at any part of the code, generally right before first reference
- concise but clear naming preferred (i.e. abbreviations)
- use camelCase to delimit multi-word names (e.g.
int theVar;instead ofint the_var;)
UpperCamelCasefor function names
- refrain from using plain
int - use
u32,u16,u8for all unsigned types - use
s32,s16,s8for all signed types - use
void*for pointer to polymorphic data with no base type
- integral iterator -
s32 i, j, k - index -
s32 idx - count -
s32 count - result code -
s32 res - value pair -
s32 a,b - character or character iterator -
char [*]c
- index -
s32 <name>Idx - count -
s32 <name>Count
- current <full_name> -
<typename> cur<uppercase name> - previous <full_name> -
<typename> prev<uppercase name>(**or<typename> <name>Prev)