This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to get .c equivalent of a .cpp


On Jul 13, 2011, at 12:00 PM, ranjith kumar wrote:

> Hi,
> 1) I read somewhere that .cpp code is converted into .c code by the
> compiler, and .c file is used to make the executable file.

This was the way first C++ compilers operated.  GCC compiles C++ code directly into assembly.

> 
> Is there any flag to get the .c equivalent of .cpp file??
> If no, how to get it?

Try searching for an old compiler that does this; beware, code may not be pretty or work reliably.  You can try LLVM, which, I think, compiles C++ into its internal representation, which you then can compile back to C.

> 
> 2)What are the all possible cases in which GCC creates the temporary objects?
> How to disable the compiler from producing temporary objects?

Try -pipe compiler option.

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]