A preprocessed *.i file is an output of the C or C++ preprocessor. It is usually this extension which is characteristic of files created as the preprocessor output. The preprocessor performs primary transformations of the source program text using only lexical analysis.
The preprocessor carries out the following operations:
The preprocessor can be used as an auxiliary tool to assist static code analysis. The PVS-Studio static analyzer, for example, can use three different preprocessors (MSVC, Clang, C++Builder), and which of them is chosen to be used for a particular project depends on the type of the project or file. This procedure is necessary because the core of the analyzer is the code parsing library VivaCore that doesn't possess an integrated preprocessor. The necessity of primary preprocessing of source files is determined by the fact that all the instructions '#include' and '#define' should be expanded to enable good static analysis.
You can get a preprocessed file in the MSVC environment by defining the value of the 'Generate Preprocessed File' property on the 'C/C++\Preprocessor' tab as shown in Figure 1.
To get a preprocessed file using the GCC compiler you need to add the parameters '-E -o file_name.i' into its call.