展开宏定义与包括宏 [英] Expand define macro with include macro
本文介绍了展开宏定义与包括宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图定义一个宏。我们的想法是,当它膨胀时,它会包括一个标头。例如:
I'm trying to define a macro. The idea is that when it expands, it'll include a header. For example:
#define function() \
include <CustomHeader.h>
非常感谢。
推荐答案
这不能做。
由此产生完全宏取代preprocessing即使它类似于令牌序列不为preprocessing指令处理之一,[...]
The resulting completely macro-replaced preprocessing token sequence is not processed as a preprocessing directive even if it resembles one, [...]
这特别的报价是从一个比较新的C ++标准的草案,但在措辞细微的变化,同样的基本思路已经出现将近永远。
That particular quote is from a reasonably recent draft of the C++ standard, but with minor changes in wording, the same basic idea has been around nearly forever.
这篇关于展开宏定义与包括宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文