c - C 宏在另一个 C 宏中展开
问题描述
我有类似的东西:
#define NBR 42
#define THE_ANS_IS theAnsIsNBR
目前,第二个宏按预期扩展为“theAnsIsNBR”,但我希望它扩展为“theAnsIs42”,我不确定它是否可能!?
解决方案
#define Paste(x, y) x##y
#define Expand(x, y) Paste(x, y)
#define NBR 42
#define THE_ANS_IS Expand(theAnsIs, NBR)
推荐阅读
- mule - 数组 JSON 模式中实体的引用对象 JSON 模式
- javascript - Angular ng-select:selectedItems.map 不是函数
- r - 有 n 个连续虚拟对象时的子集
- angular - 如何修复空数组
- javascript - 如何使用 Cloud Functions 在 Firebase 中解决“TypeError:无法读取未定义的属性 'firstname'”?
- javascript - 如何在只读 div 中显示闪烁的文本光标/插入符号
- java - Apache HttpClient,基于表单的登录,不检索 HTML 内容
- python - 改进 TSV 字符串的代码排序 ListA 给定另一个 ListB,其中包含来自 ListA 的部分字符串并返回每个模式的第一个顺序
- vba - 使用权。如何在另一个表单上创建记录并在 CBO 中选择该记录?
- python - 使用 getattrs() 访问 Foregin Key 值