Thursday, November 6, 2008

coding standard (GNU)

I feel I am quite like the coding standard with GNU by reading GTick.

1. variables and variable types are small characters. (add "_t" for types)
dsp_t* dsp;


2. function names are small characters, and written in this way: (in function name: words are connected by "_", this is my favorite way)
dsp_t* dsp_new(comm_t* comm);


3. comments in this layout.
 /* headers*/
#include < stdio.h>
#include < stdlib.h>

/*
* brief.
*
* input: from: data source of input
* from_size: the number of frames in [from]
* output: to: the pointer to the allocated data.
*
* NOTE: here is the note. [to] should be free by the caller.
*/
static int foo(short* from, int from_size, unsigned char** to);


4. CONSTANTS and MACROES are large characters.