编译器内置标准预定义宏:
__LINE__
:在源代码中插入当前源代码行号;
__FILE__
:在源文件中插入当前源文件名;
__DATE__
:在源文件中插入当前的编译日期;
__TIME__
:在源文件中插入当前编译时间;
__FUNCTION__
:在源文件中插入当前方法名;
__STDC__
:当要求程序严格遵循 ANSI C 标准时该标识被赋值为 1;
__VA_ARGS
:代表可变参数...
;
__cplusplus
:当编写 C++ 程序时该标识符被定义。
同时#line 可用来重新设定__LINE__
的值,举例如下:
1 |
|
输出为:
4
150