Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do we use .i files and how do we generate them?

I was going through the GCC man page, I found the following line:

 file.i
           C source code that should not be preprocessed.

I know that running gcc -E foo.c stops the compiler after preprocessing; but what is the real world application of creating .i files.

Also is there a way of generating a .i files other than gcc foo.c -E > foo.i?

like image 227
Nihal Harish Avatar asked Aug 05 '14 11:08

Nihal Harish


1 Answers

The .i files are also called as "Pure C files". In preprocessing stage

  1. Header files will be included.

  2. Macros will be replaced.

  3. Comments are removed.

  4. Used for conditional compilation. If you look at the .i file you can see these things.

Command to generate .i file is-

gcc -E foo.c -o foo.i
like image 153
Sathish Avatar answered Oct 11 '22 11:10

Sathish