1. '#' is to stringify the following macro parameters
1.1 Example
#include <iostream>
#define ToString(s) #s
int main(int argc, char *argv[])
{
std::cout<<ToString(sssss)<<std::endl;
return 0;
}
1.2 Output
sssss
2. '##' is a connector, mainly used to reduce code density
2.1 Examples
#include <iostream>
#define Concatenator(a, b) a##b
void ab() {
std::cout<<"This is 'ab' function."<<std::endl;
}
int main(int argc, char *argv[])
{
Concatenator(a, b)();
return 0;
}
2.2 Output
Thisis'ab'function.