• <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 );  

            久久精品无码一区二区三区免费 | 国产精品久久久久久福利漫画| segui久久国产精品| 久久99热国产这有精品| 狠狠色丁香婷婷综合久久来来去| 久久成人永久免费播放| 亚洲七七久久精品中文国产| 久久久久久精品久久久久| 99久久精品免费看国产一区二区三区 | 麻豆AV一区二区三区久久| 2021久久精品国产99国产精品| 久久精品综合一区二区三区| 亚洲AV成人无码久久精品老人| 久久久久久久亚洲Av无码| 久久精品国产色蜜蜜麻豆| 三上悠亚久久精品| 一本一本久久a久久精品综合麻豆| 一本一道久久a久久精品综合 | 合区精品久久久中文字幕一区| 精品精品国产自在久久高清| 久久www免费人成精品香蕉| 狠狠色丁香久久婷婷综合蜜芽五月 | 国产精品一久久香蕉国产线看| 久久天天躁夜夜躁狠狠| 久久国产乱子伦精品免费午夜| 国产精品久久久久aaaa| 九九久久自然熟的香蕉图片| 久久婷婷五月综合色奶水99啪| 久久久久国产精品人妻| 久久精品一区二区三区AV| 久久青青色综合| 色欲av伊人久久大香线蕉影院| 久久精品国产久精国产一老狼| 囯产精品久久久久久久久蜜桃| 国内精品伊人久久久久777| 久久婷婷色综合一区二区| 久久精品国产欧美日韩99热| 国产日产久久高清欧美一区| 色播久久人人爽人人爽人人片aV| 热re99久久精品国99热| 久久久久黑人强伦姧人妻|