分类:
2010-03-23 08:08:49
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.