Note: 1.3 Section to 1.4
To be embarrassed, I didn't read the content of the 1.3 section when I learned C, so that I had a confused, of course, the main responsibility in myself. However, there is such a big sin, a bit is not willing. Well, you have to find a reason. My reason is: Just as most friends, learning C is beginning to start from Tan Haoqiang, and the habit of single file is simply deep into the heart. After talking about the review. His old man felt embarrassed, and the book was finally loud, and my stupid self-thought of so much, I have already told, I didn't put it in my heart, these nonsense, just want to explain it. That is to read a good book is absolutely necessary.
In the 1.3 festival, the author answers the initiator will definitely ask the stupid question with the simplest language:
First: Many people will ask. #include <> and #include "" What is the difference? The answer on the book is very clear that the way to find the head file is different. May be the only unsatisfactory. The author did not tell us what is a predefined directory, sweat, it seems that the author has overestimated our poor people, the so-called predefined directory is what we usually say system catalog. The place where the standard library file is located, and then the direct point. It is a subdirectory for the directory where you install the compiler. What is the current user directory? Don't play me, you must know. Unless you have no operating system.
Second: C compatibility to C is everyone knows. But we will be very strange to discover when we write down as follows according to C standards.
#Include
Using namespace std;
The compiler does not give face. The author tells us that the original C name and C name are different. That is to say, there is no stdio at all in the STD in the namespace. All C names have to add a C prefix in the C name, which is also proven to be in the last note. A major evacuation that we have played in the machine is that we don't know what you are using. I'm inexplicably, I'm nothing.
Third: Due to the compatibility of C to C, we may ask: How do I know that is a C file, that is the C file? See the extension? This is an idea, but there is a misfortune. The author has repeatedly told us that the extension of the file in different systems is different. The author tells us a good method: use the macro, C has a "__CPLUSPLUS" C has a "__stdc__" These two names will not be at the same time exist. OK, in this case, we #ifndef or #ifdef can be, in addition, the author also tells us four macros, there is no use for beginners. Oh, I understand more, this is also the author's trust in us, unlike some textbooks ,,,,, don't mention, what is something for beginners. What is not. Who has this power judgment? In addition to yourself, the educator's task should be taken to take a complete thing, is the matter of the student, isn't it?
In addition to these knowledge above, the author also tells us to develop good habits. For example, when writing ahead, it is written as follows:
#ifndef filename_h
#define filename_h
// File main body,
#ENDIF
In order to make the document inclusion, there is more embarrassment, and there is also a hint: encouraging writing multi-file procedures, which avoids a file that is difficult to read, I have written a document of 1100 lines. When I changed, I was dizzy. There is also a benefit that when we learn I / O, the file operation can be understood, although the relationship is not large. But this is a kind of thinking habit, if you only write something. How do you understand the operation outside the file? There is also a habit to comment, I will write it here, because it is simple, but it doesn't mean it is not important. On the contrary, it is very important. Whether we don't want to forget at any time, humans can become the master of the whole world, because our cooperative ability exceeds any kind of organisms (except for creatures). The annotation is for your future cooperation, because your design is inspired to be forgotten, when you don't know yourself. Why do this code?