cc-preprocessor

C compiler preprocessor output


C compilers supports generating the preprocessor output file with .i extension.
As far as I know, this is true for Microsoft (Visual Studio), ARM, Keil and some GNU compilers.

They usually use the compiler switch -E or -P for that.
There's also the compiler switch -C to retain comments.

Is the creation of preprocessor files a standard in ANSI-C, or is this compiler specific?
Is the option -C also a standard?

EDIT:
To be more precise: This is about the support for creation of the .i file, not the compiler switch syntax or names.


Solution

  • It is not standardized in the ISO C standard.

    However most compilers seem to have -E for generating prepro output. This is reasonable as the prepro output is often very useful for debugging.

    Here is a list of compilers I checked:

    All these compilers allow writing the prepro output to any file (with any extension). The .i is definitely not standard.

    The option -C for retaining comments seems to be rather specific.