Search notes:

gcc -C / -CC

With -C or -CC, the preprocessor is instructed to keep the comments.
This is demonstrated with the following little program:
// This is a comment

/* Here's another comment */

#define NUM 42 // This C++ Style comment is converted to a C style comments with -CC. With -C, it's removed.

int returnValue() {
  return NUM;
}

int main() {
  return returnValue();
}
Github repository about-gcc, path: /options/C_/prog.c

Compiling with -P -E

When the source file is compiled with -P -E, it produces
int returnValue() {
  return 42;
}
int main() {
  return returnValue();
}
Github repository about-gcc, path: /options/C_/flag_none.i

Also using -C

With the -C option added, gcc produces:
// This is a comment
/* Here's another comment */
int returnValue() {
  return 42;
}
int main() {
  return returnValue();
}
Github repository about-gcc, path: /options/C_/flag_C.i

Using -CC

With the -CC option (instead the -C option), gcc produces:
// This is a comment
/* Here's another comment */
int returnValue() {
  return 42 /* This C++ Style comment is converted to a C style comments with -CC. With -C, it's removed.*/;
}
int main() {
  return returnValue();
}
Github repository about-gcc, path: /options/C_/flag_CC.i

See also

GCC options

Index