Linux几个调试宏__FUNCTION__ __TIME__ __LINE__ __FILE__ __DATA__

这几个宏是编译器内置的,不是在哪个头文件中包含的
直接上最简单的例子就好了,没必要多说。

源码:


1. #include <stdio.h>
2.
3. int main()
4. {
5. "The file is %s.\n",__FILE__);
6. "The date is %s.\n", __DATE__ );
7. "The time is %s.\n", __TIME__ );
8. "This is line %d.\n", __LINE__ );
9. "This function is %s.\n", __FUNCTION__ );
10.
11. return 0;
12. }

运行结果:


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