使用__FUNCTION__进行字符串化不起作用 [英] Stringizing with __FUNCTION__ not working

查看:45
本文介绍了使用__FUNCTION__进行字符串化不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

LINE相似的问题

但是当我用 __FUNCTION__ 替换 __LINE__ 时.宏concat字符串文字" __ FUNCTION __ "而不是实际的函数名称.

But when I replaced __LINE__ with __FUNCTION__. Macro concat string literal "__FUNCTION__" and not actual function name.

推荐答案

__ FUNCTION __ 不是宏,它是一个隐式声明的静态数组.对于 __ func __ __ PRETTY_FUNCTION __ 等也是如此.

__FUNCTION__ is not a macro, it's an implicitly declared static array. The same is true for __func__, __PRETTY_FUNCTION__, etc.

因此#无法对其进行操作.如果要将其串联起来,则必须在运行时执行.

Thus # can't work on it. If you want to concatenate something to it, you'll have to do that at runtime.

这篇关于使用__FUNCTION__进行字符串化不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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