Nullptr
In C + + it is better to use this instead of NULL (usually defined as 0, you can redefine it), on the one hand, the code is readable, marked as a pointer, on the other hand, see the following situation
Declaration of Function 1 void f (int i, int* p);
Declaration of Function 2 void f (int i, int p);
Then you call F (4, NULL) probably want to call the 1th function, but sadly, you call the 2nd one. Then define
#define NULL ((void*) 0) not? The answer is no, C + + does not allow void * variables to be assigned to other types of pointers (vice versa)
Also, if you use a template, it may cause compilation errors. Like what
void Test (std::p air<int*, int> p), the function, if you call the test (Std::make_pair<null, 4>) the compiler will error. Of course, a function can be converted if it defines the
Test (int *p), call Test (0) or test (NULL), then the system is automatically converted to null pointer call above, this will not cause the compiler to error
VS2010, about precompiled header files
The settings in the project are set by default for all files that are set individually. For example, a.cpp "Using Precompiled header Files"
If the project is not used by default, then A.cpp is using the precompiled header file alone. If you do not define stdafx.cpp at this time, you should define a stdafx.cpp,stdafx.h and specify Stdafx.cpp as "Create Precompiled Header File" (Otherwise you compile will say cannot find the. pch file), although there is no test, but I think the precompiled header file should be able to use other names, but must be guaranteed to be used to create a precompiled header file, the other for use.
Once you have used the precompiled header file for CPP in a directory, even if the CPP is not in the same directory as the StdAfx.h, the compilation will not prompt you to find the file, because as long as your project has a. PCH, this CPP will find the appropriate information.