EASY Question!

I just want to know what the flag is that you would put with g++ to create the C representation of the C++ program??

g++ first changes the C++ program to a C program and runs gcc on it, so how can I stop it and display the C file?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>>g++ first changes the C++ program to a C program and runs gcc on it,

whereever u found this information . didnt they mention how to do this?

did u try looking at g++ manual .. all its capabilities are very well documented in its man page
The C and C++ compilers are integrated; g++ is a script to
call gcc with options to  recognize  C++.   gcc  processes
input  files  through  one or more of four stages: prepro-
cessing, compilation, assembly,  and  linking.  

this never said that it converts the code to c..
so as far as i see...it calls gcc to recognize c++ code .. but  i doubt if it ever tries to convert to c..
InternAuthor Commented:
Well if that is the case, my professor had no idea what he was talking about then.  He told me that g++ translated a C++ program to C then ran gcc on the C program.  

I thought a translator would make life easier, but I guess I will just start writing in C.  Maybe I will get good at that too.
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

InternAuthor Commented:
Linux does turn C and C++ code into assembly, then it runs an assembler on that code right?

because you can get the assembly listing with -S
yes u can get the assembly listing.. and with -E u can get the preprocessed listing ..

but i am not sure that if u dont specify the -S option then  also it will try to make the assembly code ..
 may be it can generate object code directly from C code ..
but i have strong feeling that it does make the assembly code first .. always

and about your professor .. well he may be right .. why not u ask him for the  details . i wud luve to have new knowledge
.. but i believe there is no such intermediate step..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
in some discussion i came across this comment from some other expert .. might be of some interest to you..

In the long long time ago ...
C++ compiler always convert *.CPP to *.C, before compile it to machine code.
You can't believe it now, but yes it did. It convert the object into struct, the method into modified function, etc.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.