C Preprocessor output -
this question has answer here:
for gcc -e sample.c -o sample.i
following input c program,
#include <stdio.h> int main() { printf("hello world\n"); return 0; }
the sample.i
have following output preceded #
symbols , wonder line #
means.
# 1 "sample.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "sample.c" # 1 "/usr/include/stdio.h" 1 3 4 # 27 "/usr/include/stdio.h" 3 4 ...
there comments person identify how preprocessor expanded various #include <...> macros , other items.
reading these lines provides equivalent of reading logging messages of preprocessor encounters macros , expands them.
# 1 "sample.c"
start on line 1 of input "sample.c"
# 1 "<built-in>"
process built-in c pre-procssor directive (must implementation detail), presented fake "file".
# 1 "<command-line>"
process command line directive (again implementation detail), presented fake "file".
# 1 "/usr/include/stdc-predef.h" 1 3 4
include (at line 1) stdc-predef.h file, it's start of file, suppress warnings permitted system header files, assure symbols treated c symbols.
# 1 "<command-line>" 2
return command line "fake" file.
# 1 "sample.c"
back in sample.c.
# 1 "/usr/include/stdio.h" 1 3 4
now starting file "stdio.h", suppress permitted system warnings, treat symbols in file c symbols.
# 27 "/usr/include/stdio.h" 3 4
and on...
Comments
Post a Comment