且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

__FILE__,__LINE__和__FUNCTION__在C ++中的用法

更新时间:2022-06-13 02:36:06

__ FUNCTION __ code> __ func __ 存在于C99 / C ++ 11中。其他人( __ LINE __ __ FILE __ )很好。

__FUNCTION__ is non standard, __func__ exists in C99 / C++11. The others (__LINE__ and __FILE__) are just fine.

如果你选择使用 __ FUNCTION __ / __ func __ )优化,它总是报告正确的文件和行是一个非因子因为它是一个编译时宏扩展。它将从不以任何方式影响效果。

It will always report the right file and line (and function if you choose to use __FUNCTION__/__func__) optimization is a non-factor since it is a compile time macro expansion. It will never effect performance in any way.