2

I have a hello world program of the source code in C of the following:

For #include <stdio.h>

#define MESSAGE "Hello, world!"

int main()
{
    puts(MESSAGE);
    return 0;
}

Now if we preprocess the source code by gcc, we get in front:

# 1 "hello-world.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "hello-world.c"
# 1 "/usr/include/stdio.h" 1 3 4
# 28 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 361 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 365 "/usr/include/sys/cdefs.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 366 "/usr/include/sys/cdefs.h" 2 3 4
# 362 "/usr/include/features.h" 2 3 4
# 385 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4

My question is apparently, # 1 gets repeated, and so on. So what does this mean? What would # 28 and # 365 and # 385 mean?

user56220
  • 327
  • 1
  • 3
  • 6

1 Answers1

0

Those are source line numbers in the given files. For example, # 28 "/usr/include/stdio.h" 3 4 precedes lines that originated in line 28 of stdio.h.

You can read more by GCC's preprocessor output here. The format for the lines you've shown is:

# linenum filename flags
interjay
  • 107,303
  • 21
  • 270
  • 254