c++预编译宏
1.预编译宏概念
一段微软官方文字:
The Visual C++ compiler predefines certain preprocessor macros, depending on the language (C or C++), the compilation target, and the chosen compiler options.
VC++编译器预先定义某些预处理器宏,其具体取决于语言,编译目标和所选的编辑器选项
预编译宏一般以"__
“结尾并且以”__
“结尾,中间的单词全部大写,如果由多个单词组成,则单词之间使用”_
"连接。
2.__FILE__
__FILE__
:显示当前源文件的名称。
当这个宏放在函数中和放在宏中所产生的会是不一样的结果。
头文件:
#include<iostream>
using namespace std;
#define HR(){cout<<__FILE__<<":in #