设为首页  
联系我们  
加入收藏  
网页制作 冲浪宝典 图形图像 操作系统 软件教学 编程开发 认证考试 安全技术 站长专区 文学驿站 娱乐天地 游戏天地 办公软件
文章搜索
您的位置: 首页 >> 文章首页 >> 编程开发 >> 其他开发语言 >> Apache DevelopersC Language Style Guide -- 最优代码风格(我认为)
精品推荐
其他开发语言点击TOP10
·数字小键盘指法练习
·用C语言编通讯录程序(初学者级别的)
·Modem 常用AT指令集
·单片机模拟I2C总线及24C02(I2C EEPROM)读写实例(源代码)
·C++经典电子书下载
·Thinking in C++ 简体中文第二版
·debug和release的区别
·error LNK2001: unresolved external symbol __ftol2 错误解决
·C库函数手册
·一个简单的C语言编译器
编程开发点击TOP10
·数字小键盘指法练习
·ASP.NET 程序中常用的三十三种代码
·用C语言编通讯录程序(初学者级别的)
·我写的Java学生成绩管理系统源代码
·CHK文件恢复工具
·Modem 常用AT指令集
·java笔试题
·异常java.sql.SQLException: Io exception:The Network Adapter could not establish connection
·单片机模拟I2C总线及24C02(I2C EEPROM)读写实例(源代码)
·C++经典电子书下载
精选专题

Apache DevelopersC Language Style Guide -- 最优代码风格(我认为)

作者: 来源:网络文章 时间:2005-12-17 21:00:48

Apache DevelopersC Language Style Guide -- 最优代码风格(我认为)(1)

Apache Developers' C Language Style Guide

Compiled by Paul Sutton paul@awe.com. Based on a vote taken in November, 1996.
Further refinements voted upon in July 1997.


IntrodUCtion

[This bit could state that code should be laid out to be clear to someone else familiar with Apache. Functions should be short and easily understood. Comments should be provided to eXPlain the rationale for code which is not obvious, and to document behavior of functions. The guidelines can be broken if necessary to acheive a clearer layout]

This style can be generated with the following arguments to GNU indent:

    -i4 -npsl -di0 -br -nce -d0 -cli0 -npCS -nfc1

The Guidelines

  • Opening braces are given on the same lines as statements, or on the following line at the start of a function definition.
  • Code inside a block (whether surrounded by braces or not) is indented by four space characters. Tab characters are not used. Comments are indented to the same level as the surrounding code.
  • Closing braces are always on a separate line from surrounding code, and are indented to line up with the start of the text on the line containing the corresponding opening brace.
  • Functions are declared with ANSI-style arguments.
  • There is no space between the function name and the opening bracket of the arguments to the function. There is a single space following commas in argument lists and the semi-colons in for statements.
  • Inside a switch() statement, the case keyWords are indented to the same level as the switch line.
  • Operators in expressions should be surrounded by a single space before and after, except for unary increment (++), decrement (--), and negation (!) operators.
  • There is no whitespace between a cast and the item modified (e.g., "(int)j" and not "(int) j").
  • If a cast is to a pointer type, there is a space between the type and the * character (e.g., "(char *)i" instead of "(char*)i")

Details and Examples

  1. Indentation, General Style

共3页 9 7 [1] [2] [38 :>

Apache DevelopersC Language Style Guide -- 最优代码风格(我认为) 相关文章:
Apache DevelopersC Language Style Guide -- 最优代码风格(我认为) 相关软件:
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
转载请注明来源:http://www.xgdown.com