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

            沒畫完的畫

            喂馬 劈柴 BBQ~
            posts - 37, comments - 55, trackbacks - 0, articles - 0
              C++博客 ::  :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            #define 指令

            Posted on 2008-09-14 16:56 沒畫完的畫 閱讀(223) 評論(0)  編輯 收藏 引用 所屬分類: 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" ); 
            }
             

            如此的定義在進行處理時將被轉換為如下代碼:
            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" );
            }


            程序運行結果如下:
            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); 

            這條語句將被擴展為 

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

            3、連接符(Token-Pasting Opertor)

            ##

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

            如果一個數字作為此宏的參數調用的話, 

            paster( 
            9 ); 

            宏被展開為 

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

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

            国产麻豆精品久久一二三| 日产精品久久久久久久性色| 久久99久久无码毛片一区二区| 国产2021久久精品| 精品国产婷婷久久久| 伊人伊成久久人综合网777| 99久久精品九九亚洲精品| 久久人妻少妇嫩草AV蜜桃| 国内精品人妻无码久久久影院导航 | 66精品综合久久久久久久| 精品多毛少妇人妻AV免费久久| 国产激情久久久久影院老熟女免费| 青青热久久国产久精品 | 久久激情亚洲精品无码?V| 久久99精品久久久久久动态图 | 国产成人无码久久久精品一| 99热精品久久只有精品| 久久无码国产专区精品| 久久精品国产精品亜洲毛片| 丁香色欲久久久久久综合网| 久久精品国产一区| 99久久精品费精品国产一区二区 | 久久久久久a亚洲欧洲aⅴ| 亚洲国产另类久久久精品黑人| 久久伊人色| 亚洲乱亚洲乱淫久久| 亚洲AV无码久久精品成人| 一本久道久久综合狠狠躁AV| 99久久精品这里只有精品 | 91久久香蕉国产熟女线看| 久久精品亚洲一区二区三区浴池| 亚洲国产一成人久久精品| 婷婷久久综合| 久久久久无码国产精品不卡| 伊人色综合久久天天| 91精品观看91久久久久久| 国产精品久久免费| 狠狠久久亚洲欧美专区| 99久久99久久| 国产99久久久久久免费看 | 精品久久久无码中文字幕天天|