1. process-oriented programming involves several basic elements, which are constrained by programming specifications.
Notes: file comments, function comments, line comments, and block comments.
Compilation preprocessing: File Inclusion, condition inclusion, macro definition, global variable declaration, function declaration, and other compilation preprocessing statements.
Function: The function header, the definition of the function body (flow control statement, data structure and data type (variable or object), operator expression, and function call ).
Error Handling: system call failure, if statement judgment, function entry parameters and exit parameter legality detection, etc.; reasonable error handling structure (Application of macro definition and error information array ).
2. Specifications
I think all naming rules should follow numbers, lowercase letters, and underscores. The Hungary naming and camel naming rules belong to C ++ and java. C should have its own naming rules.
Naming: a variable name and a file name are generally nouns and a verb is used for a function. The macro definition is capitalized. (The above can be underlined ). Avoid magic numbers.
Note: This document describes who completed the file and the copyright version. Function comments should describe the main functions implemented by the function and the parameters to return values, and focus on the global variables called. The line comment block comment is mainly used to explain difficult algorithms.
File structure: the Declaration of global variables is generally placed in a header file. and avoid including multi-file.so using condition-precompile