There is a significant difference between C and C++ for functions with empty argument lists. In C, the declaration:
means “a function with any number and type of argument.” This prevents type-checking, so in C++ it means “a function with no arguments.”
在C/C++中void fun(void) 都表示无参数函数
As C++ evolved, different compiler vendors chose different extensions for file names. In addition, various operating systems have different restrictions on file names, in particular on name length. These issues caused source code portability problems. To smooth over these rough edges, the standard uses a format that allows file names longer than the notorious eight characters and eliminates the extension. For example, instead of the old style of including iostream.h, which looks like this:
you can now write:
There’s a relationship between namespaces and the way header files are included. Before the current header file inclusion style of <iostream> (that is, no trailing ‘.h’) was standardized, the typical way to include a header file was with the ‘.h’, such as <iostream.h>. At that time, namespaces were not part of the language either. So to provide backward compatibility with existing code, if you say
using namespace std;
Because the linker searches files in the order you give them, you can pre-empt the use of a library function by inserting a file with your own function, using the same function name, into the list before the library name appears. Since the linker will resolve any references to this function by using your function before it searches the library, your function is used instead of the library function.