Chinaunix首页 | 论坛 | 博客
  • 博客访问: 583964
  • 博文数量: 141
  • 博客积分: 3425
  • 博客等级: 中校
  • 技术积分: 1609
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-23 15:55
文章分类

全部博文(141)

文章存档

2019年(5)

2011年(19)

2010年(36)

2009年(13)

2008年(50)

2007年(18)

分类: C/C++

2008-12-01 23:29:38

Meaningful Names

1 Capitalization

The following capitalization style is recommended because it gives the programmer as
well as the reader of the code more information.
• Variables: Use lower-case words separated by underscores.
• Function names: Capitalize the first letter of each word; do not use underscores.
• Constants: Use upper-case words separated by underscores.
• C bindings: Use the letter “c” followed by an underscore and the binding name.

Example: capitalization style

open_database variables
ProcessError function names
MAX_COUNT constants
c_ephemrd C bindings

2 Type and Constant Names

• Type names (i.e., created with typedef):  
  Follow the naming standards for global variables.

• Enumeration types (declared using enum) and constants declared using const:

  Follow the naming conventions for constants.

(From the 《C STYLE GUIDE》)


阅读(682) | 评论(0) | 转发(0) |
0

上一篇:发展建议

下一篇:tears in eyes

给主人留下些什么吧!~~