1

Look at this example:

#include <stdio.h>
int main (void)
{ 
    printf ("Hello, world!\n"); return 0;
} 

It is possible to see the declarations from the included header file by preprocessing the file with gcc -E:

$ gcc -E hello.c 

On a GNU system, this produces output similar to the following:

# 1 "hello.c" 
# 1 "/usr/include/stdio.h" 1 3 
extern FILE *stdin;      
extern FILE *stdout;        
extern FILE *stderr;        
extern int fprintf (FILE * __stream, const char * __format, ...) ; 
extern int printf (const char * __format, ...) ; 

//   [ ... additional declarations ... ] 

# 1 "hello.c" 2 
int main (void)
{ 
    printf ("Hello,           world!\n");
    return 0; 
}

I would like to know the meaning of the numbers in the # lines (i.e. #1..., #1 ... 1 3 and #1 ... 2 in the last #).

jww
  • 97,681
  • 90
  • 411
  • 885
Bento
  • 223
  • 1
  • 12
  • 1
    I googled "gcc preprocessed source code" and obtained https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html – Sci Prog Oct 17 '16 at 02:58
  • Also I had looked gcc.gnu.org, but I had not found that section. Your answer is what I needed. Thanks. – Bento Oct 17 '16 at 04:16

0 Answers0