for catalog
可读性
80 列限制
仅针对 extern 变量或者函数使用下划线前缀
extern size_t __total_mem_use;
很多库都是用下划线当函数前缀
goto 用法
goto failed
return t;
failed:
if (t) {
if (t->table)
free(t->table);
free(t);
}
return NULL;
常见缩写
nr, sz, dbl, tri, prev, conn, ctxt, err
简洁
i, j, k
extern “C”
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /* __cplusplus */
#endif
避免 warning
switch 分支中不加 break,为避免产生 warning 需要加注释
/* falls through */
from c 语言最佳实践