为类名称创建预处理器宏的预处理器宏? [英] Preprocessor macro to create preprocessor macro for class name?
问题描述
请注意,我已经有了一个解决方法,我只是想扩展我对预处理器的了解.例如,关于编写自己的计算机语言的任何好文章?
我想创建一个预处理器宏,该宏将定义类似于__FUNCTION__的类名.
C级
应该替换为
C级
#define __CLASS__ #C
有没有办法让预处理器创建其他预处理器宏?
我尝试了以下
#define PP_CLASS(C)C类#define CLASS_NAME #C
Note that I already have a workaround, I am just looking to expand my knowledge of the preprocessor. For instance, any good articles on writing your own computer language?
I would like to create a preprocessor macro that will define the classname similar to __FUNCTION__.
class C
should be replaced by
class C
#define __CLASS__ #C
Is there a way to get the preprocessor to create other preprocessor macros?
I''ve tried the following
#define PP_CLASS(C) class C #define CLASS_NAME #C
推荐答案
这是不可能的.
这有什么需要?
我确定您的解决方法足够好.
This is not possible.
What is the need for this?
I''m sure your workaround is good enough.
这篇关于为类名称创建预处理器宏的预处理器宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!