preprocessor operator

memo탬플리트movistnetworknewAvanteXDphoto preprocessor operator






1 Stringizing operator (#)

Actions : Causes the corresponding actual argument to be enclosed in double quotation marks

example
int main() {
   printf_s( "In quotes in the printf function call\n" "\n" );
   printf_s( "\"In quotes when printed to the screen\"\n" "\n" );
   printf_s( "\"This: \\\" prints an escaped double quote\"" "\n" );
}
// stringizer.cpp
#include <stdio.h>
#define stringer( x ) printf( #x "\n" )
int main() {
   stringer( In quotes in the printf function call ); 
   stringer( "In quotes when printed to the screen" );   
   stringer( "This: \"  prints an escaped double quote" );
}

output
In quotes in the printf function call
"In quotes when printed to the screen"
"This: \"  prints an escaped double quote"


2 Charizing operator (#@)

Actions : Causes the corresponding argument to be enclosed in single quotation marks and to be treated as a character (Microsoft Specific)

3 Token-Pasting Operator (##)

Actions : Allows tokens used as actual arguments to be concatenated to form other tokens

example
// preprocessor_token_pasting.cpp
#include <stdio.h>
#define paster( n ) printf_s( "token" #n " = %d", token##n )
int token9 = 9;

int main()
{
   paster(9);
}
output
token9 = 9

4 defined operator

Actions : Simplifies the writing of compound expressions in certain macro directives

ID
Password
Join





- 전 이런 놈입니다.

격언> 인생은 단순하다. 단지 사람이 그것을 복잡하게 만들 뿐이다. (공자)

Recent Changes

D  Echoes Of War(The... @ 2012-05-18 [03:44 pm] by windlesszone
D  Diablo3 @ 2012-05-15 [04:49 pm] by windlesszone
D  Diablo3/story/wizard @ 2012-05-15 [04:48 pm] by windlesszone 4 changes
D  Diablo3/story/wit... @ 2012-05-15 [04:16 pm] by windlesszone
D  Diablo3/story/monk @ 2012-05-15 [04:14 pm] by windlesszone





Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2006-11-23 15:44:19
Processing time 0.0504 sec