C and C++ Style Guides – Archived version of a collection of style guides
libevent – Available API to maybe seek inspiration from. Uses callbacks and stuff.
Embedded C Coding Standard – By Michael Barr
int variable, descriptive_variable_name; typedef int own_datatypes_t; void function_names(void); void mylib_library_function_with_prefix(void); typedef enum myenum_t { MYLIB_GLOBAL_SCOPE_ENUM, } myenum_t; const int constant; #define ANY_DEFINE_OR_MACRO
void foo(void) { } if(a) { } switch(a) { case A: break; case B: case C: break; default: break; }
if(a == b) // Not any of these if (a == b) if( a == b ) // Compare to function call strlen (str) strlen( str )
uint32_t *my_func(); uint32_t* my_func(); uint32_t * my_func(); uint32_t *my_var; uint32_t* my_var; uint32_t * my_var; uint32_t *my_var, *another_var, third_var; void a_function_with_a_really_long_name_and_argument_list(int that, int makes, int you, int wonder, int where int and_how, int to, int break_the, int lines);