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》)
阅读(685) | 评论(0) | 转发(0) |