http://hi.baidu.com/419836321/blog/item/fcf5ceec484681cfb31cb1f7.html
__FILE__ is used in C to indicate the filename of the source file in which the statement is written, for example (test.c) :
GCC compiler generates a.out. After execution, the output is: test.c Compiling results under Windows VC6.0 are as follows: C :\ Documents and Settings \ Administrator \ Desktop \ Test.c ——————————————————————————————————————————————————————————————————– ————————————————————————– __LINE__ in C is used to indicate the position of the statement in the source file. Examples are as follows:
main() { The program is compiled in Linux with GCC, in Windows VC6.0 under the compilation can pass, the execution results are: 7 8 9 __LINE__ can also be reset with the #line statement, for example:
# line 200 After compilation and execution, the output is: 202 203 204 ——————————————————————————————————————————————————————————————————– ————————————————————————— GCC also supports __func__, which indicates the function, but this keyword is not supported in VC 6.0 under Windows, for example:
The output result after compilation is this is print by function main Note # “line”, “__LINE__”, “a __FILE__” and “__func__” are case sensitive. |