“C”标准是否支持类似于 __func__
的函数参数名称?
最佳答案
不,C99 标准有以下内容:
6.10.8 Predefined macro names
The following macro names shall be defined by the implementation:
__DATE__
__FILE__
__LINE__
__STDC__
__STDC_HOSTED__
__STDC_MB_MIGHT_NEQ_WC__
__STDC_VERSION__
__TIME__
The following macro names are conditionally defined by the implementation:
__STDC_IEC_559__
__STDC_IEC_559_COMPLEX__
__STDC_ISO_10646__
6.4.2.2 Predefined identifiers
The identifier
__func__
shall be implicitly declared by the translator as if, immediately following the opening brace of each function definition, the declaration
static const char __func__[] = "function-name";
出现了,其中 function-name 是词法封闭函数的名称。63)
gcc 添加了一些 extensions ,正如我想象的其他编译器所做的那样。
关于c - C 是否具有函数参数名称的 __func__ 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/905999/