Professional Documents
Culture Documents
Coding Guidelines
Coding Guidelines
Generic Guidelines
Define a structure only in header files
Define an enum only in header files
Use header guard _<HeaderFileName>_ in all the header files (Ex: _MDSR_IPTVTUNERAPI_H_)
Provide function headers for each function
Provide file header for each file
Try to initialize the variable while defining
Don't use Tabs. Assume 1 Tab = 4 spaces
Source code files should be in UNIX format
Make the header files re-usable in C++ environment (Use extern C)
Labels should be prefixed/suffixed with corresponding function names (Ex: _MDSR_IPTV_TUNER_OPEN_END)
Use OLSP_CHAR (char) for strings. Don't use OLSP_UINT8 or OLSP_SINT8
Page 1
Examples
Naming examples
Array of structures S_patInfo_t a_s_pat[10]
Array of pointers S_pmtInfo_t *ap_s_pmt[10]
Float OLSP_FLOAT32 f32_var
32-bit Signed Integer OLSP_SINT32 s32_cnt
32-bit Unsigned Integer OLSP_UINT32 u32_time
String OLSP_CHAR a_ch_name[32]
Structure Definition
typedef struct S_youtubeClientObjectTag
{
OLSP_SINT32 s32_streamId;
E_youtubeClientErrCode_t e_errorCode;
pthread_t s_monitorThreadId;
OLSP_CHAR a_ch_thumbailName[256];
} S_youtubeClientObject_t;
Enum Definition
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /* END: extern "C" */
#endif
Page 2