views:

56

answers:

2

Hi,

  1. If any, what are the (obviously ignored by GCC) comments below called?
  2. How do I get rid of them?

Here:

eisbaw@leno:~/GCC$ cpp < /dev/null
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
eisbaw@leno:~/GCC$ 
+2  A: 

You probably don't want to get rid of them. They are inserted by the precprocessor so that any compiler that reads this compilation unit can determine the source file and line number that spawned any line it examines. Without it, you can't get meaningful errors like "syntax error on line 7 of main.cpp: semicolon expected." Or whatever.

If you REALLY want to ditch them, you can always just write something quick that will kill anything beginning with "# ".

+3  A: 

They are called linemarkers and you can use -P to have cpp or gcc omit them.

They are described in the Preprocessor Output section of the cpp manual.

And I agree with user30997 that you probably don't want to get rid of them. They are ignored by gcc in the sense that they do not affect the compilation process, but they do provide useful diagnostic information when your code does not compile correctly.

Dan