A pretty safe rule of thumb is: look at what has already been done and try to do the same.
Try to use short names whenever possible (i
for indices, w
for width, cv
for canvas...). Macros are always uppercase, variable and function names are always lowercase. Use the underscore to separate words within names:
const
is a suffix. It's char
const
*foo
, not const
char
*foo
.
Use spaces after commas and between operators. Do not use spaces after an opening parenthesis or before a closing one:
Do not put a space between functions and the corresponding opening parenthesis:
A space can be inserted after keywords such as for
, while
or if
, but consistency with the rest of the page is encouraged:
Do not put parentheses around return values:
Opening braces should be on a line of their own, aligned with the current block. Braces are optional for one-liners:
Nothing here yet.