原文地址::https://blog.csdn.net/zz460833359/article/details/51935334
相关文章
1、Linux下代码运行时间的高精度测量----https://wenku.baidu.com/view/d752620e52ea551810a68749.html
2、Linux调试宏的使用----https://blog.csdn.net/fengjinghuanian/article/details/88233351
3、LINUX 调试宏定义----http://blog.chinaunix.net/uid-20768928-id-5740572.html
4、Linux内核调试方法总结之调试宏----https://www.cnblogs.com/justin-y-lin/p/5424495.html
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