青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆 - 45  文章 - 129  trackbacks - 0
<2007年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

專注于C++ P2P STL GP OpenSource等
Google

常用鏈接

留言簿(10)

隨筆分類

隨筆檔案

相冊

朋友

  • .NET

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

先講#和#@字符:這兩個比較類似:前者是將所代表的東西字符串化,后者是將代表的東西字符化。

而##可以說是個符號粘合劑。(Modern C++中用來做編譯時期內存檢查--2.1節 就是用了這個符號)

#的用法

The number-sign or "stringizing" operator (#) converts macro parameters (after expansion) to string constants. It is used only with macros that take arguments. If it precedes a formal parameter in the macro definition, the actual argument passed by the macro invocation is enclosed in quotation marks and treated as a string literal. The string literal then replaces each occurrence of a combination of the stringizing operator and formal parameter within the macro definition.

White space preceding the first token of the actual argument and following the last token of the actual argument is ignored. Any white space between the tokens in the actual argument is reduced to a single white space in the resulting string literal. Thus, if a comment occurs between two tokens in the actual argument, it is reduced to a single white space. The resulting string literal is automatically concatenated with any adjacent string literals from which it is separated only by white space.

Further, if a character contained in the argument usually requires an escape sequence when used in a string literal (for example, the quotation mark (") or backslash (\) character), the necessary escape backslash is automatically inserted before the character. The following example shows a macro definition that includes the stringizing operator and a main function that invokes the macro:

#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" );
}

Such invocations would be expanded during preprocessing, producing the following code:

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" );
}

When the program is run, screen output for each line is as follows:

In quotes in the printf function call

"In quotes when printed to the screen"

"This: \" prints an escaped double quotation mark"

Microsoft Specific

The Microsoft C (versions 6.0 and earlier) extension to the ANSI C standard that previously expanded macro formal arguments appearing inside string literals and character constants is no longer supported. Code that relied on this extension should be rewritten using the stringizing (#) operator.

END Microsoft Specific

#@的用法


Microsoft Specific

The charizing operator can be used only with arguments of macros. If #@ precedes a formal parameter in the definition of the macro, the actual argument is enclosed in single quotation marks and treated as a character when the macro is expanded. For example:

#define makechar(x)  #@x

causes the statement

a = makechar(b);

to be expanded to

a = 'b';

The single-quotation character cannot be used with the charizing operator.

END Microsoft Specific

##的用法

The double-number-sign or "token-pasting" operator (##), which is sometimes called the "merging" operator, is used in both object-like and function-like macros. It permits separate tokens to be joined into a single token and therefore cannot be the first or last token in the macro definition.

If a formal parameter in a macro definition is preceded or followed by the token-pasting operator, the formal parameter is immediately replaced by the unexpanded actual argument. Macro expansion is not performed on the argument prior to replacement.

Then, each occurrence of the token-pasting operator in token-string is removed, and the tokens preceding and following it are concatenated. The resulting token must be a valid token. If it is, the token is scanned for possible replacement if it represents a macro name. The identifier represents the name by which the concatenated tokens will be known in the program before replacement. Each token represents a token defined elsewhere, either within the program or on the compiler command line. White space preceding or following the operator is optional.

This example illustrates use of both the stringizing and token-pasting operators in specifying program output:

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

If a macro is called with a numeric argument like

paster( 9 );

the macro yields

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

which becomes

printf( "token9 = %d", token9 );
posted on 2007-01-19 14:03 CPP&&設計模式小屋 閱讀(1638) 評論(1)  編輯 收藏 引用 所屬分類: 其他

FeedBack:
# re: 關于 ## ,#以及#@的用法 2007-04-21 18:47 heweitykc
c++整的這么復雜啊 以后怎么維護啊!  回復  更多評論
  
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
              欧美成人免费大片| 欧美va天堂在线| 欧美成人在线影院| 亚洲小视频在线| 欧美日韩黄色一区二区| 亚洲第一页中文字幕| 亚洲欧美视频在线| 91久久在线播放| 欧美在线综合视频| 欧美网站大全在线观看| 国产精品国产福利国产秒拍| 性欧美办公室18xxxxhd| 一区二区三区www| 欧美精品在线一区二区| 亚洲国产一区二区三区青草影视| 欧美影院成年免费版| 99精品热视频| 欧美午夜精品电影| 亚洲视频综合在线| 欧美91视频| 久久综合九色综合网站| 亚洲高清免费在线| 欧美v日韩v国产v| 久久婷婷久久| 91久久精品美女| 欧美激情一区在线| 欧美精品日韩一区| 亚洲一区二区综合| 亚洲一区二区三区精品视频| 午夜精品国产精品大乳美女| 欧美日韩国产一中文字不卡| 一区二区三区高清在线| 免费观看欧美在线视频的网站| 国产真实久久| 久久综合一区| 久久精品欧洲| 亚洲人成在线播放| 99热免费精品在线观看| 国产精品一香蕉国产线看观看| 久久国产精品99国产精| 美女成人午夜| 正在播放亚洲| 欧美综合77777色婷婷| 国产一区在线看| 欧美mv日韩mv国产网站app| 欧美jizz19性欧美| 国产午夜精品久久久久久免费视| 久久综合九色综合欧美就去吻| 免费不卡在线视频| 亚洲欧美中文另类| 先锋影音一区二区三区| 激情综合色综合久久综合| 亚洲欧美一区二区精品久久久| 亚洲视频精选| 欧美日韩一区在线视频| 亚洲国产欧美不卡在线观看 | 久久人人97超碰人人澡爱香蕉| 欧美精品一区二区三区高清aⅴ| 久久久九九九九| 国产精品裸体一区二区三区| 亚洲精品自在久久| 在线亚洲激情| 欧美日韩天堂| 99精品欧美一区| 一本到12不卡视频在线dvd| 欧美激情精品久久久| 欧美高清在线视频观看不卡| 亚洲激情校园春色| 欧美黄色精品| 99视频精品全国免费| 一区二区三区回区在观看免费视频| 美女精品视频一区| 亚洲国产精品久久久久婷婷老年| 亚洲日本电影| 欧美色道久久88综合亚洲精品| 亚洲久久视频| 午夜久久福利| 激情丁香综合| 免费看亚洲片| 夜夜狂射影院欧美极品| 欧美亚洲一区二区在线观看| 国产精品美女久久福利网站| 欧美一二区视频| 狂野欧美激情性xxxx| 亚洲经典在线| 欧美日一区二区三区在线观看国产免| 亚洲第一区在线| 亚洲伊人一本大道中文字幕| 国产精品一区二区在线观看网站| 午夜精品一区二区三区在线播放| 性欧美videos另类喷潮| ●精品国产综合乱码久久久久| 欧美xx69| 亚洲午夜精品国产| 另类专区欧美制服同性| 亚洲久久一区| 国产日韩欧美二区| 欧美成人免费播放| 一区二区三区四区五区精品视频| 欧美中文在线观看| 亚洲精品1234| 国产欧美一区二区三区沐欲| 美女被久久久| 亚洲欧美伊人| 亚洲激情六月丁香| 久久久精品一区| 亚洲免费高清| 国产视频在线一区二区| 欧美国产日本| 欧美在线观看一区二区| 日韩午夜高潮| 欧美a一区二区| 先锋影院在线亚洲| 日韩视频在线一区| 国产一区日韩二区欧美三区| 欧美人与禽性xxxxx杂性| 久久9热精品视频| 洋洋av久久久久久久一区| 乱人伦精品视频在线观看| 午夜久久一区| 中文亚洲欧美| 亚洲精品日韩激情在线电影| 国产一区二区三区免费在线观看| 欧美裸体一区二区三区| 久久精品官网| 亚洲欧美中文在线视频| 这里只有精品视频| 亚洲精品永久免费精品| 欧美xxxx在线观看| 久久久亚洲一区| 欧美一区91| 欧美亚洲免费电影| 亚洲欧美精品在线观看| 在线视频日本亚洲性| 亚洲精品美女在线观看播放| 激情欧美国产欧美| 国产一区二区三区网站| 国产乱码精品一区二区三区av| 欧美日韩一区二区三区| 欧美精品日韩www.p站| 蜜臀va亚洲va欧美va天堂| 久久夜色精品国产| 免费高清在线一区| 麻豆久久久9性大片| 久久蜜桃香蕉精品一区二区三区| 久久精品国产亚洲精品| 欧美一区二区三区四区夜夜大片| 亚洲欧美99| 久久久精品欧美丰满| 欧美一区二区成人6969| 午夜日韩视频| 午夜亚洲视频| 久久精品视频播放| 久久久青草婷婷精品综合日韩| 亚洲欧美激情视频| 久久久久亚洲综合| 乱中年女人伦av一区二区| 男女精品视频| 欧美日韩视频专区在线播放 | 国内自拍亚洲| 亚洲区一区二| 亚洲影音一区| 久久精品人人爽| 农夫在线精品视频免费观看| 亚洲福利视频网| 亚洲最新合集| 欧美在线免费| 免费视频最近日韩| 欧美日韩在线一区二区| 国产精品伦子伦免费视频| 国内精品久久国产| 亚洲精品久久久久久下一站 | 亚洲第一精品夜夜躁人人躁| 亚洲日本va午夜在线电影| 亚洲手机成人高清视频| 欧美在线黄色| 亚洲高清成人| 一区二区三区久久久| 欧美一区=区| 欧美剧在线观看| 国产亚洲欧美在线| 日韩一区二区电影网| 久久九九全国免费精品观看| 亚洲高清免费在线| 亚洲欧美日韩国产| 欧美激情一区二区三区在线视频| 母乳一区在线观看| 国产亚洲精品美女| 一区二区三区欧美| 久久综合网色—综合色88| 亚洲伦理自拍| 卡通动漫国产精品| 国产精品三级久久久久久电影| 亚洲激情视频在线| 久久成人综合视频| 日韩视频在线观看免费| 久久亚洲午夜电影| 国产精品网红福利| 一区二区三区高清| 亚洲欧洲在线一区|