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...

the documentation here.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -