惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
Jina AI
Jina AI
博客园_首页
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
Forbes - Security
Forbes - Security
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
N
News | PayPal Newsroom
S
Security Archives - TechRepublic
量子位
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
C
Cisco Blogs
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
Scott Helme
Scott Helme
S
Securelist
Security Latest
Security Latest
爱范儿
爱范儿
TaoSecurity Blog
TaoSecurity Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
Intezer
L
LINUX DO - 最新话题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Check Point Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
美团技术团队
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
PCI Perspectives
PCI Perspectives
月光博客
月光博客
T
Tailwind CSS Blog
Cloudbric
Cloudbric
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
Kaspersky official blog
D
DataBreaches.Net
博客园 - 【当耐特】
有赞技术团队
有赞技术团队

博客园 - zhucde

一句话的解释 给场景添加一个背景 ATI显卡中不能使用CG的变态原因 ORA-28000: the account is locked Oracle10g, EM中,ERROR: Wrong password for user ActiveX中嵌入Flash, 在IE中调用时, 与Flash的交互问题 Ogre中解决中文路径和中文文件名的方法 子节点(ChildNode)设置WorldPostion [转贴]c/c++ struct union 对齐方式 OpenGL程序 转为Opengl ES 的一点建议glDrawArray和glDrawElements [陆续更新] IPhone中编译Ogre源码及使用 Ogre控件在网页中调用的问题 在3D中, 将世界坐标映射为屏幕上的坐标点 更新一下道路的最新效果,处理了边缘, 加入了Shader光照 OGRE中新做的火焰和爆炸 刚刚从CSDN的博客搬家过来, 有些文章的内容逐步完善, 请多多谅解! 在Ogre中使用DirectShow来播放视频--重新封装并测试通过(已完整) 新加的一个天空的效果. (已完整) [OGRE]继续完善道路-----道路两侧物体匹配(已完整)
宏定义中"#"的用法 - zhucde - 博客园
zhucde · 2011-01-09 · via 博客园 - zhucde

惭愧, 今天测试了才真正明白, 在宏定义中使用"#",  还是因为群里有TX提出, 才测试的

看代码:

#define macro(a) #a
#define macro2(a,b) a##b
#define macro3(a,b,c) a##b##c

 #a,  表示a不再是一个变量, 而变成了字符串"a"

##表示连接, a##b,  表示输入的参数名为ab,  a##b##c同理, 代表变量名为: abc

测试例子:

int x = 3;
int y = 4;
int xy = 10;
int xyz=20;
CString str;

OutputDebugString(macro(x));

str.Format(

"%d",macro2(x,y));
OutputDebugString(str);

str.Format(

"%d",macro3(x,y,z));
OutputDebugString(str);

输出结果为:

x

10

20

第一个为x,  marco(x),  x变成了"x"字符串

第二个为10, macro(x,y), 就是变量xy

第三个为20, macro(x,y,z), 就是变量xyz

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhucde/archive/2011/01/09/6125069.aspx