C++ 的 __LINE__和 __FUNCTION__

Linux几个调试宏__FUNCTION__ ,__TIME__ ,__LINE__ ,__FILE__这几个宏是编译器内置的,不是在哪个头文件中包含的;

__FUNCTION__ :函数名
__TIME__ :文件运行的时间
__LINE__ :所在行数
__FILE__:文件的名字

#include <stdio.h> int main()
{ printf("The file is %s.\n",__FILE__);
printf( "The date is %s.\n", __DATE__ );
printf( "The time is %s.\n", __TIME__
); printf( "This is line %d.\n", __LINE__ );
printf( "This function is %s.\n", __FUNCTION__ );
return 0;
}

猜你喜欢

转载自www.cnblogs.com/pzf9266/p/9389212.html