这几个宏是编译器内置的,不是在哪个头文件中包含的
直接上最简单的例子就好了,没必要多说。
源码:
#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.
<span style="line-height: 26px; font-size: 16px; color: rgb(51, 51, 51); font-family: Arial; background-color: rgb(46, 48, 51);">这几个宏是编译器内置的,不是在哪个头文件中包含的。</span><span style="line-height: 26px; font-size: 16px; color: rgb(51, 51, 51); font-family: Arial; background-color: rgb(46, 48, 51);">直接上最简单的例子。</span> <wbr style="line-height: 28px; color: rgb(44, 44, 44); font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: rgb(46, 48, 51);"><div style="line-height: 28px; color: rgb(44, 44, 44); font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: rgb(46, 48, 51);"><span style="line-height: 26px; color: rgb(51, 51, 51); font-family: Arial;"> </span><img alt="Linux几个调试宏__FUNCTION__, __TIME__, __LINE__, __FILE__ , __DATA__ - liuxin_arm - 工程师成长之路" src="http://img2.ph.126.net/OyUjHKo-NtnA6zm3vv96qQ==/6597571143960571298.jpg" style="line-height: 23px; border: 0px; max-width: 100%; height: auto; margin: 0px 10px 0px 0px;" /></div><div style="line-height: 28px; color: rgb(44, 44, 44); font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: rgb(46, 48, 51);"> </div><div style="line-height: 28px; color: rgb(44, 44, 44); font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: rgb(46, 48, 51);"> 运行结果:</div><div style="line-height: 28px; color: rgb(44, 44, 44); font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: rgb(46, 48, 51);"><img alt="Linux几个调试宏__FUNCTION__, __TIME__, __LINE__, __FILE__ , __DATA__ - liuxin_arm - 工程师成长之路" src="http://img2.ph.126.net/OsU3GHE9qh_0_dk2OhjwoA==/6597553551774523238.jpg" style="border: 0px; max-width: 100%; height: auto; margin: 0px 10px 0px 0px;" /></div> </wbr>