__FUNCTION__和朋友在Xcode中行为怪异 [英] __FUNCTION__ and friends act weird in Xcode
问题描述
这项工作
printf("%s body\n",__PRETTY_FUNCTION__);
但这不是(错误 Expected')'
):
printf(__PRETTY_FUNCTION__" body\n");
我无法让IDE显示 __ PRETTY_FUNCTION __
求值以确定为什么它不工作。
I can't get the IDE to show me what __PRETTY_FUNCTION__
evaluates to to determine why it does not work.
推荐答案
上面链接中的最后一段是:
The last paragraph in the link above reads:
这些标识符不是预处理器宏。在GCC 3.3及更早版本中,仅在C中,
__ FUNCTION __
和__ PRETTY_FUNCTION __
它们可以用于初始化char数组,并且它们可以与其他字符串字面连接。 GCC 3.4和更高版本将它们视为变量,如__ func __
。在C ++中,__ FUNCTION __
和__ PRETTY_FUNCTION __
始终是变量。
These identifiers are not preprocessor macros. In GCC 3.3 and earlier, in C only,
__FUNCTION__
and__PRETTY_FUNCTION__
were treated as string literals; they could be used to initialize char arrays, and they could be concatenated with other string literals. GCC 3.4 and later treat them as variables, like__func__
. In C++,__FUNCTION__
and__PRETTY_FUNCTION__
have always been variables.
这篇关于__FUNCTION__和朋友在Xcode中行为怪异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!