Skip to content

Programming Style

adlan edited this page Feb 16, 2011 · 2 revisions

Code Layout

  • Length of line must not exceed 80 characters
  • Use K&R style (1TBS variant)
  • 2 spaces for indentation. Use whitespace instead of tab

Function

  • Put function name after closing brace
void doSomething()
{
} // doSomething()
  • When function have more than one arguments, if there are any argument of type bool, use enum instead. Define the option in BOption enum.
// so when calling a function,
configureRxDescriptor(index, kBDOptionReuse);
// is more descriptive than
configureRxDescriptor(index, true);
Clone this wiki locally