Save comments in i preprocessor file

We want to use the output preprocessor file ( .i file) for future reference, especially comments.
To do this, we use the /PREPRINT command line /PREPRINT (or /PP ).
The problem is that the KEIL compiler (C166) removes any comments.

Q: Can I leave comments in the .i file?

Additional research:
The Microsoft compiler does this with the /P command line switch.
But they have a /C for comments.

+6
source share
2 answers

I get that the Keil C166 compiler also supports the /C switch. This switch is not available through the IDE and is not documented.
To use it, we had to write a batch file containing the /C switch and run the compiler a second time to create the .i file.

It also turns out that all the compilers we use have this switch (Mircosoft, and, as Arun Taylor, the GCC compiler mentioned). Thus, we can use the .i comment from each compiler.

+1
source

you can use

 gcc -E -CC file.c 

It stores all comments, including .h files that can be included in the C file.

+3
source

Source: https://habr.com/ru/post/946414/


All Articles