c - C 是否具有函数参数名称的 __func__ 功能?

标签 c func

“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/

相关文章:

c - GtkCell渲染器文本 : "editable-set" set to FALSE does not deactivate editability?

C# LINQ 和函数

c# - 隐式转换为 Func 或 Action 委托(delegate)?

c - 如何设置 Eclipse 以使用 gdbserver 进行远程 C 调试?

C 编程 - 免费方法给我一个无效的下一个大小(快速)错误

c - 如何在没有循环的情况下将数组初始化为 C 中的某物?

c - 在 CUDA C 中确定计算机在运行时是否有 GPU

c# - 是否有可能获得一个 Action 中的语句数量或确定它是否有空体?

c# - 调用具有可选参数的 Func<T1, T2, T3>?

c# - 异步函数陷入死锁?