CodeStylehttp://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStylecheck tool:
Time:
Mar.16,2012.
Minutes:
1. Kernel 使用tab缩进,转换成space是不允许的,原因是易读,超过3层缩进需要你重新设计程序。
2. 80列限制:never break user-visible strings such as printk messages, because that breaks the ability to grep for them.
3. Typedefs只有5种情况能用。
4. 函数长度:ISO/ANSI screen size is 80x24,函数长度80x24~80x48, local变量不超过5-10
5. 多行Macro用do...while()完成,有4中Macro的禁忌
6. 不要对超过3行的函数inline
7. 常用的宏:include/linux/kernel.h
8. 函数返回值的定义
阅读(1616) | 评论(0) | 转发(0) |