Win32:Token-Pasting Operator (##)

#define paster( n ) printf_s( "token" #n " = %d", token##n )

int token9 = 9;

If a macro is called with a numeric argument like

 
paster( 9 );

the macro yields

 
printf_s( "token" "9" " = %d", token9 );

which becomes

 
printf_s( "token9 = %d", token9 );

 
// preprocessor_token_pasting.cpp

#include <stdio.h>

#define paster( n ) printf_s( "token" #n " = %d", token##n )

int token9 = 9;



int main()

{

   paster(9);

}

token9 = 9

你可能感兴趣的:(Opera)