sy-CPROG

__FILE__用以指示本行语句所在源文件的文件名.
#include <stdio.h> int main() { printf("%s\n",__FILE__); }
vi另存为test.c, gcc编译生成a.out,执行后输出结果为:
test.c
__LINE__用以指示本行语句在源文件中的位置信息,

输出:
4
5
6
webpack配置文件里随处可见这种全局变量__dirname的使用:

example:
running node example.js from /Users/mjr
console.log(__dirname); // Prints: /Users/mjr console.log(path.dirname(__filename)); // Prints: /Users/mjr
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24475491/viewspace-2680358/ ,如需转载,请注明出处,否则将追究法律责任。