I haven't written a BLOG for a long time. ^_^
If you don't know what to write, write something that is easy to ignore.
I. Special string macros
[Cpp]
# Define A (x) T _ # x
# Define B (x) # @ x
# Define C (x) # x
Assume that x = 1, the macro definition above will be interpreted as follows:
A (1) ------> T_1
B (1) ------> '1'
C (1) ------> "1"
These functions are mainly used in string processing functions and parameter naming. They are not complex, but few are known.
Ii. Shielding useless parameter warnings
[Cpp]
# Define UNUSED_PARAM (p) (void) p)
This is used to block invalid Parameters
For example
[Cpp] view plaincopy
Void a (int x1, int x2)
{
// Do nothing
}
A warning is displayed. x1 and x2 are invalid parameters.
However, it doesn't matter if you write it like this.
[Cpp]
Void a (int x1, int x2)
{
UNUSED_PARAM (x1 );
UNUSED_PARAM (x2 );
}
3: I can't think of it. I want to hold a place and wait until I wake up.
I will not write more common macro usage, such as the header file security macro, version definition macro, flexible use indeed get twice the result with half the effort.
Author: vonger