• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 37, comments - 55, trackbacks - 0, articles - 0
              C++博客 ::  :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            #define 指令

            Posted on 2008-09-14 16:56 沒(méi)畫(huà)完的畫(huà) 閱讀(214) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): VC

            1、字符串化(Stringizing Operator)

            #

            #define stringer( x ) printf( #x "\n" ) 
            int main() 
            {
                stringer( In quotes 
            in the printf function call\n ); 
                stringer( 
            "In quotes when printed to the screen"\n ); 
                stringer( 
            "This: \" prints an escaped double quote" ); 
            }
             

            如此的定義在進(jìn)行處理時(shí)將被轉(zhuǎn)換為如下代碼:
            int main() 
            {
                printf( 
            "In quotes in the printf function call\n" "\n" ); 
                printf( 
            "\"In quotes when printed to the screen\"\n" "\n" );
                printf( 
            "\"This: \\\" prints an escaped double quote\"" "\n" );
            }


            程序運(yùn)行結(jié)果如下:
            In quotes 
            in the printf function call 
            "In quotes when printed to the screen" 
            "This: \" prints an escaped double quotation mark" 


            2、字符化(Charizing Operator)

            #@

            例子:#define makechar(x) #@x 

            causes the statementa 
            = makechar(b); 

            這條語(yǔ)句將被擴(kuò)展為 

            = 'b';注意單引號(hào)字符不能使用這樣的字符化。  

            3、連接符(Token-Pasting Opertor)

            ##

            #define paster( n ) printf( "token" #n " = %d", token##n ) int token9 = 9; 

            如果一個(gè)數(shù)字作為此宏的參數(shù)調(diào)用的話(huà), 

            paster( 
            9 ); 

            宏被展開(kāi)為 

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

            進(jìn)而成為這樣的語(yǔ)句:printf( 
            "token9 = %d", token9 );  

            99国内精品久久久久久久| 丰满少妇高潮惨叫久久久| 亚洲欧洲久久久精品| 99精品国产免费久久久久久下载| 久久激情亚洲精品无码?V| 一本久久综合亚洲鲁鲁五月天| 久久狠狠爱亚洲综合影院| 精品久久久久久国产潘金莲| 激情久久久久久久久久| 亚洲午夜久久久久久久久久| 天天爽天天爽天天片a久久网| 久久国产AVJUST麻豆| 久久国产精品久久久| 久久狠狠爱亚洲综合影院 | av午夜福利一片免费看久久| 国产香蕉97碰碰久久人人| 久久国产精品成人影院| 无码任你躁久久久久久老妇| 久久精品中文字幕久久| 久久精品无码专区免费东京热| 久久本道综合久久伊人| 91精品无码久久久久久五月天 | 久久精品国产精品青草| 久久亚洲AV成人无码| 久久99精品久久久久久9蜜桃| 国产成人精品免费久久久久| 国产A级毛片久久久精品毛片| 久久综合久久伊人| 久久性生大片免费观看性| 国产一区二区精品久久岳| 国产精品岛国久久久久| 久久精品黄AA片一区二区三区| 97久久婷婷五月综合色d啪蜜芽| 人人狠狠综合久久亚洲高清| 久久久精品久久久久特色影视| 国产精品gz久久久| 久久国产福利免费| 久久国产成人| 亚洲精品乱码久久久久久蜜桃| 一级做a爰片久久毛片免费陪| 伊人久久五月天|