Talk about my understanding of C / C
/ ************************************************** ***************** This article is first in BBS.Bluegem.org's CWORLD zone * I email: Chenfei@sohu.com*, please keep the first place and my contact Way to make it easy to communicate, thank you! *********************************************************** **************** /
First: C and C are completely two different languages, although C sometimes looks like C. Their most important difference is the idea of programming. Regardless of C or C is not entirely advanced language, they are largely connected to the platform. The "platform" here may refer to different hardware platforms, such as X86, PowerPC, SPAR or 64-bit amdopterne; also refers to a specific software platform, universal Linux, Win32, non-universal, such as a block, IBM MQ. So learning C / C will grasp the knowledge of both aspects, not related to the platform or to the characteristics of the C / C language itself and related features related to the platform.
Let's talk about the knowledge that has nothing to do with the platform. 1, grammar. This is basically nothing to talk. Proficiency in the most commonly used, knowing where it is a mine area, pay attention to some details, such as SizeOf () in different context results, function's meticulous and argument, class copy constructor, etc. 2, standard library. Regardless of C or C , the language itself provides a powerful standard library, such as String, Errno, Time, especially in C , etc. The familiarity of standard libraries can make our programming less into the road, and the realization of standard libraries is the most efficient and most stable. I think Microsoft MSDN is one of the best electronic documents. 3, programming specifications or habits. This is a necessary condition for a qualified programmer and is also an important sign from the student programmer to the professional programmer. If you want to improve in this area, you can refer to Dr. Lin Rui's "High Quality C _ C Programming Guide", the web "programming", etc. In fact, the programming specification is not necessary ink, and different units or even different projects are different for the requirements, and the program is clear, the code is stable, easy to read, easy to maintain, professional and in line with relevant regulations. 4, programming engineering management. Programming specifications are for individuals, while engineering management is for all programmers responsible for the project. Engineering management first emphasizes the ability to accept management, if the task delivered by the superior is not completed as required, then, if the individual can manage the module responsible for, such as the arrangement of the project file (this Win32 The programmer is fortunate, regardless of the VC or BCB, it has made the project's management very well, and most of the * NIX programmers must do this part of this part of the work), and the functional division design of functions. These are small-scale project management practices. Some programmers who have both talents and diligent efforts will gradually take the project team leader until CTO, responsible for the overall management of the project. There are many specific management methods, such as CMMs of the College. Besides, after a certain size, the narrow software engineering has no possible to adapt to the needs of project management, and the programmer requires some management ideas and means of traditional engineering. 5, programming ideas. The guiding ideology of programming ideas, like the great Mao Zedong Thought in China Revolutionary Practice. There is a big difference in programming ideas of C / C . C emphasizes the process theory, C emphasizes the object-oriented theory. As the technical progress is the process theory that cannot meet the needs of the era, it is mainly reflected in the big project, and the use of purely-oriented processes will be developed. The programmer often caught in how to achieve the functions that the former people have implemented, especially the design of the GUI, it is difficult to put Energy is concentrated in business logic; and the code is chaotic, it is difficult to implement effective maintenance and secondary development. The object-oriented theory solves this problem, but this does not mean that the process theory is eliminated. Any object-oriented language still uses a process-oriented three-axis ax: order, conditional selection, and loop. From this perspective, the process not only has no weakened, but it is more important than before. The core of object-oriented programming is multiplexed, and some work that often do is well packaged, allowing programmers to focus on business logic. There is also an important feature in C programming ideas: norm programming, such as STL. Please note that STL is not an object-oriented product. It is actually not a lot of people who do the process-oriented C, which can be very deep in C , at least I am: (. Many times we write the program can only be called "object-based "of.
Let me talk about the platform-related knowledge. 1. System-level data types and APIs. First, the data type, very old example, the 16-bit machine and 32-bit machine INT lengths are two bytes and four bytes, respectively. In addition, the data type, the MS defines N multi-data type on the basis of the standard data type, and those who write VC may be deeply affected. Look at the software source code of Linux cross-operative system platform will also find countless #ifdef ..... The system-level API is generally C interface, Win32 has SDK, DirectX, etc., typical functions have WinMain (), sendMessage (); Linux's glibc, typical functions have setuid (), tmpfile (). 2, data types and APIs of non-universal platforms. There are also some specific software and hardware environments that also provide specific data types and APIs, such as encryption cards, drives provided by data transfer cards; IBM's MQ (MQ provides C and C two-way interface API). 3, different class libraries. Working with C under different platforms, you must be familiar with the relevant class library, such as MS's MFC, cross-platform universal library has boost, I have used a plus / decryption algorithm Crypto (Crypto also provides C and C two interface API ). Learning to reuse the code of the former people is also a Kung Fu. Development is always carried out under a particular platform, so familiar with at least one system-level API or class library is necessary. It is also familiar with some specific libraries based on different focus and project requirements. For example, I used to use some additional solution algorithms, I must be very familiar with Crypto . In addition, familiarity is familiar with and using some public uses, such as Boost, has a half-time effect on development work. 4. Understand the process of compilation and connection. Static links, dynamic links, and uninstall of libraries. The project is bigger, and it is natural that all the questions can be solved. The programmer under the MS platform refers to MSDN, and Linux programmers can refer to "Advanced-Linux-Programming" 5, where you are at least familiar with a development debugging tool in any platform. Windows programmers are very happy, MS provides integrated development environment Visual C (. Net), Borland provides BCB; traditional Linux programmers generally use GCC and GDB, there are many integrated development environments in Linux, greatly facilitating development. These are unlikely to finish all over a few days, need to be gradually improved in work. Initially, in terms of grammar, norms, and standard libraries, the foundation is constructed. With the increase of work experience, it will gradually be dominated in engineering, responsible for some overall design. At this time, it is necessary to consciously use the theoretical oriented theory to design, and formulate code specifications that meet yourself. Think of what functional modules that may be used before you can use, is there possible to reuse the code of the present person, is these multiplexed code correctness and efficiency in line with your own requirements? Confucius said that he would not think about it. After completing the project, the rest is adjusted for a while, and then re-examine the design to specific coding, there will be a lot of experience. Usually look at the standard libraries and systems libraries, and familiar with public use libraries such as Boost, with unpredictable. In addition to mentioning these specific implementations, if you can see some programming ideas in high-hustu, it is better, such as "Thinking In C " "design mode" is a good learning material. There are now many open source excellent projects, reading the code of these items, finds the bugs of them and communicating with the author, and is also an important way to improve the technical level. In some major projects, it is possible to provide an API programming interface to others. The definition of the interface requires two parties to formulate, and the style is close to the standard library or MFC, Boost's professional library.
This article is full of traditional programming. With many new technologies in the era, such as the N-layer structure represented by Java and .net (you can refer to my other article "My Java Road "); There are ActivX, COM, CORBA, basically unfolded around the Internet, the original intention is cross-platform, the most core purpose is still multiplexed. Learn about these technologies, it is also an increase in your own professional skills, which is also very beneficial to deepening traditional programming.