Pre-processing macros in C + +
An example of a preprocessing macro:
# define PRINT (Str,var) cout<<str "=" <<VAR<<endl;
The arguments in parentheses following the macro name are replaced by all code that follows the closing parenthesis. Whenever the macro is called, the preprocessor removes the name print and replaces the code, so the compiler does not report any error messages when using the macro name, and it does not do any type checking on the parameters.
Another example:
# define P (EX) cout<< #EX << ":" <<EX<<endl;
The "#" is called the preprocessing feature of the string, and its function is to get any expression and convert it to a character array.
C + + function address
Once the function is compiled and loaded into the computer, it consumes a chunk of memory. This memory has an address, so the function also has an address. Once a function pointer is defined, it must be given a function address before it is used. As the address of an array arr[10] is generated by an array name (arr) without square brackets, the address of the function func () is also generated by the function name (func) without the parameter list. You can also use the more obvious syntax: &func (). In order to invoke this function, the pointer should be referenced indirectly in the same way as the declaration.
Pre-processing macros in C + +