I print out the output of C preprocessor by using
gcc -E a.c
The output contains many lines like
# 1 "a.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "a.c" # 1 "c:\\mingw\\bin\\../lib/gcc/mingw32/4.5.0/../../../../include/stdio.h" 1 3 # 19 "c:\\mingw\\bin\\../lib/gcc/mingw32/4.5.0/../../../../include/stdio.h" 3 # 1 "c:\\mingw\\bin\\../lib/gcc/mingw32/4.5.0/../../../../include/_mingw.h" 1 3 # 31 "c:\\mingw\\bin\\../lib/gcc/mingw32/4.5.0/../../../../include/_mingw.h" 3 # 32 "c:\\mingw\\bin\\../lib/gcc/mingw32/4.5.0/../../../../include/_mingw.h" 3 # 20 "c:\\mingw\\bin\\../lib/gcc/mingw32/4.5.0/../../../../include/stdio.h" 2 3
I've never seen this kind of syntax in C. Can someone explain what this is doing?
All Preprocessor directives begin with the # (hash) symbol. C++ compilers use the same C preprocessor. The preprocessor is a part of the compiler which performs preliminary operations (conditionally compiling code, including files etc...) to your code before the compiler sees it.
This is a null directive, as much as an ; without a preceeding expression in the core-language is a null statement . For the preprocessor it is just for formatting/readability to highlight that the lines belong semantically together.
These lines are hints for debugging (where the code following the line actually came from)
# line-number "source-file" [flags]
Meaning of flags (space separated):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With