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. |
Read More:
- Analysis of compilation errors of “error conflicting types for function”
- error: a label can only be part of a statement and a declaration is not a statement (How to Fix)
- Errno in Linux Programming
- Explain stdin, stdout, stderr in C language
- C error C2143 syntax error missing before ‘type’
- Error in comparing the size function of STL with negative number
- C + + pauses the black window system (“pause”); (get ch(), getchar(), system (pause)’s connection and difference
- C + + uses system (“pause”) to pause black windows
- panic: runtime error: index out of range
- C / C + + library function (tower / tower) realizes the conversion of letter case
- The function and usage of argc and argv in C language
- [Warning] incompatible implicit declaration of built-in function ‘strcat’
- pthread_ Introduction and application of join function
- Implementation of Python switch / case statements
- Vs debug window flashback
- Tensorflow in function tf.Print Method of outputting intermediate value
- Python: Understanding__ str__
- Error c2137 of C language: empty character constant (Fixed)
- Linux dynamically loads kernel modules
- C language write() function analysis: write failed bad address