您的位置:首页 > 运维架构 > Linux

Linux几个调试宏_FUNCTION_ _TIME_ _LINE_ _FILE_ _DATA_

2016-07-17 23:11 435 查看
Linux几个调试宏__FUNCTION__ __TIME__ __LINE__ __FILE__ __DATA__
这几个宏是编译器内置的,不是在哪个头文件中包含的

直接上最简单的例子就好了,没必要多说。

源码:

#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;
}

运行结果:

The file is macro.c.
The date is Aug 24 2012.
The time is 23:13:26.
This is line 8.
This function is main.

 

转自:http://m.myexception.cn/linux-unix/690606.html#modile.qq.com
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux 内置宏 调试