0

I was looking at the result of the C preprocessor after compiling my code with gcc -E. Anywhere where I have used NULL, it has been replaced as in the following snippet:

struct TokenStream *tks = 
# 48 "src/main.c" 3 4
                             ((void *)0)
# 48 "src/main.c"
                                 ;

Another example:

struct AST *ast = 
# 60 "src/main.c" 3 4
                     ((void *)0)
# 60 "src/main.c"
                         ;

Are these hashtagged lines ignored by the compiler? Or do they play a role in code generation or linking?

Thanks in advance.

  • https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html – Eugene Sh. Aug 13 '21 at 17:07
  • [Documentation](https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#index-E) for the `-E` switch: *Stop after the preprocessing stage; do not run the compiler proper.* So, your question is really a bit moot, as the compiler doesn't do anything after generating those hash symbols. – Adrian Mole Aug 13 '21 at 17:09
  • @AdrianMole this is technically correct, but it is not answering the gist of the question. Without `-E`, the same code would be fit into the compiler, so the question about the meaning of those lines is still valid (albeit it is a duplicate indeed). – SergeyA Aug 13 '21 at 17:10

0 Answers0