为类名称创建预处理器宏的预处理器宏? [英] Preprocessor macro to create preprocessor macro for class name?

查看:83
本文介绍了为类名称创建预处理器宏的预处理器宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意,我已经有了一个解决方法,我只是想扩展我对预处理器的了解.例如,关于编写自己的计算机语言的任何好文章?

我想创建一个预处理器宏,该宏将定义类似于__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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆