Chinaunix首页 | 论坛 | 博客
  • 博客访问: 295720
  • 博文数量: 47
  • 博客积分: 1190
  • 博客等级: 少尉
  • 技术积分: 523
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-14 20:30
文章分类

全部博文(47)

文章存档

2016年(1)

2012年(46)

我的朋友

分类: LINUX

2012-03-16 01:23:46


CodeStyle
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStyle


check 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. 函数返回值的定义

阅读(1546) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~