分类: C/C++
2010-03-29 21:04:16
The # and ## preprocessor operators are used with the #define preprocessor directive.
For example, the command
#define to_string( s ) # swill make the compiler turn this command
<< to_string( Hello World! ) << endl;into
<< "Hello World!" << endl;Here is an example of the ## command:
#define concatenate( a, b ) a ## b ... int xy = 10; ...This code will make the compiler turn
<< concatenate( x, y ) << endl;into
<< xy << endl;which will, of course, display '10' to standard output.