I am relatively new to C ++ and I am in the class. A lab was assigned to our class, and my teacher said the lab entry was a little hard to understand; however, he did not make any changes to the laboratory entry. So, I came across this part of the lab:
Preprocessor Macro Definition
The long-term convention uses macros, and this macro name must be TRACE_FUNC. A macro has a single parameter, a character, which will be replaced by the name of the function when the macro is applied to the code. The beginning of the macro is as follows:
#define TRACE_FUNC( symbol ) replacement-text`
and the preprocessor will replace the replacement text wherever there is a TRACE_FUNC (sym) line in the source code, and feed the character into this replacement.
NOTE. The #define statement must be on the same logical line. To keep the length manageable, you can avoid the newline character with a backslash at the end of the line; which will keep the preprocessor happy, allowing you to define the definition over multiple lines.
For this exercise, the replacement text should be complete, including the ending half-line.
Replaceable text should be an output statement that prints a character followed by a call to text (). and a new line for standard output. You can copy and modify one of the output statements from the warning.cpp source file.
warning.cpp- this is only the file we use and TRACE_FUNCis placed in the header file.
, , 100%, . , , , TRACE_FUNC. -, TRACE_FUNC. , , TRACE_FUNC, , , . , . , , , , , TRACE_FUNC.
, , , , TRACE_FUNC . , , foo() , foo() ( foo, ) . , , -, , # . , . ?
, , , .
#define TRACE_FUNC( foo() ) #foo() called. ;
#define TRACE_FUNC( foo ) #foo () called. ;
, , , #define. , , , .
, . TRACE_FUNC , , - , ? TRACE_FUNC, , ?