C ++/CThe program processes functions differently. Extern "C" is a means to enable C ++ to call library files written by C. If you want to prompt the compiler to use the C method to process functions, use extern "C" to describe.
If all the developers of the research project team follow a unified and distinctive set of programming styles, they can make the collaborators, successors and themselves clear at a glance, and clearly view the program structure in a short time, understand the design concept and greatly improve code readability, reusability, program robustness, portability, and maintainability.
The purpose of this programming specification is to improve the efficiency of software development and the maintainability of the software to improve the quality of the software. This specification consists of the program style, naming conventions, annotation specifications, program robustness, portability, error handling, and software modular specifications.
Each C ++/C program is generally divided into two files. A file is called a header file to save the declaration of the program. Another file is used to save the Program implementation), known as the definition) file.
The header file of the C ++/C program is h "is the suffix, And the definition file of the C program is". c "is the suffix, And the definition file of the C ++ program is usually". cpp is suffixed with ". cc "or". cxx ). Early programming languages such as Basic and Fortran do not have the concept of header files. Although C ++/C Beginners use header files, they often do not understand the concept. Here, the role of the opposite file is slightly explained:
1) Use the header file to call the library function. In many cases, the source code is inconvenient or inaccurate. You only need to provide the header file and binary Library to the user. You only need to follow the interface declaration in the header file to call the library function, without worrying about how the interface is implemented. The compiler extracts the corresponding code from the library;
2) the header file can enhance the type security check. If an interface is implemented or used in a different way than the declaration in the header file, the compiler will point out an error. This simple rule can greatly reduce the burden on programmers to debug and correct errors. Assert is not a hasty macro. In order not to cause any difference between the Debug and Release versions of the program, assert should not produce any side effects.
So assert is not a function, but a macro. Programmers can regard assert as a harmless testing method that can be safely used in any system status. If the program terminates at assert, it does not mean that the function containing this assert has an error, but the caller has an error. assert can help us find the cause of the error.
Most people refer to too many details or "too many dark corners" as the essence of C ++, and think that all evil is born from this. Therefore, in about September, Linus said on the mail list that "C ++/C Programs are a language with ideological burdens, just to keep programmers away from C ++, I also want to use C ". This short sentence has aroused a great reaction in China. When Liu jiang switched to Linus, Yun Feng and Meng Yan both expressed their views; I also wrote an article "Why C ++" and sent it to Bjarne. Bjarne made a friendly comment on this article ).
However, I believe that the changes may not be very great. Most of the original opponents can find out the reasons for their opposition, so they are more opposed. Most of the original advocates can also find the reasons for their consent, so they agree more. The remaining ones do not have clear opinions, there may be no clue as to why each party has its own logic.