-
Notifications
You must be signed in to change notification settings - Fork 2
CodingStandards
Wu Jie edited this page Mar 30, 2014
·
2 revisions
All macros should define with upper-case character.
Special Case:
-
Expose to user, define it by adding prefix "EX_".
#define EX_FOOBAR 1
All local variable should start with lower-case character.
Special Case:
-
use prefix
__define a static variable in .c file.// file name: test.c static int __counter = 0;
-
use prefix
_declare a parameter in a function.void foobar ( int _count ) { ... }
-
Always add
ex_prefix and_tsuffix for structure exposed to user.typedef struct ex_foobar_t { } ex_foobar_t;
-
Always add
externkeyword when declare a global function in a header file.extern void foobar (int);
-
use prefix
__define a static function in .c file.static void __foobar () { ... }
-
Always add
ex_prefix for function write in exsdk exposed to user.extern void ex_foobar (int);