code named rules: 1. function named rules: lowercase letter(file name or module name) + underline + capital initial letter + capital initial letter e.g.: os_CreateSemaphore(void); fs_Open(void); 2. local variant named rules: lowercase letter + underline + lowercase letter e.g.: char list_string_end; char list; 3. global variant named rules: lowercase letter(file name or module name) + underline + lowercase letter + underline + lowercase letter e.g.: char fs_list_head; char fs_i; 4. typedef/typedef enum/typedef struct named rules: capital letter(file name or module name or other) + underline + capital letter + underline + capital letter + T e.g.: typedef unsigned char UNSIGNED_CHAR_T; typedef unsigned char * OS_CB_T; typedef enum { YELLOW_L, WRITE_Y, BLUE_G }FS_COLOUR_T; typedef struct { char data[MAX_SS_LEN]; int len; }FS_DATA_T; 5. enum named rules: capital letter(file name or module name or other) + underline + capital letter + underline + capital letter + E e.g.: enum { YELLOW, WRITE, BLUE }FS_COLOUR_E; enum { Y, W, B }C_E; 6. union named rules: capital letter(file name or module name or other) + underline + capital letter + underline + capital letter + U e.g.: union { int a; int b; int c; }C_E_U; union { int a_q; int b_j; int c_a; }FS_E_U; 7. struct named rules: capital letter(file name or module name or other) + underline + capital letter + underline + capital letter + S e.g.: struct FS_ASSIGN_S { int* logical_unit; int assign_info; }; 8. macro named rules: capital letter(file name or module name or other) + underline + capital letter + underline + capital letter e.g.: #define OS_QUEUE_MAX 100 #define FILE_NUM 120
文章评论(0条评论)
登录后参与讨论