C++研究

C++细节深度探索及软件工程

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  37 随笔 :: 0 文章 :: 74 评论 :: 0 Trackbacks
thanks to SuperPlayeR, I saw  the define 's especial usage like this :


(1)#define Conn(x,y) x##y
(2)#define ToChar(x) #@x
(3)#define ToString(x) #x



for (1) Conn(1,3) --> 13
         Conn("ksk","l") --> "kskl"

for (2)  if x 's length less than 3 , it returns the rightest const char  else error
        E.G ToChar(123) --> '3'
              ToChar(1234) -->Error
for (3) ToString (1234) -->"1234"

posted on 2007-04-21 02:41 常兴龙 阅读(137) 评论(1)  编辑 收藏 引用

评论

# re: Define 's espcial usage! 2007-11-14 21:05 c
int i = 10;
cout << ToString(i) << endl;

output:
i  回复  更多评论
  


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


> hi的博客