see compiler generated code

M

mkorobko

I was wondering if there is a way to see the source code generated by
compiler - anything that compiler inserts such as constructors,
destructors, vptr, etc . Looking at this can help to learn.
 
P

Phlip

I was wondering if there is a way to see the source code generated by
compiler - anything that compiler inserts such as constructors,
destructors, vptr, etc . Looking at this can help to learn.

This is one of those questions where you will also get good answers from the
forum covering your own compiler.

I would...

- debug the code and step into each method
- debug with the disassembly turned on, so you can see the opcodes
- use cfront, IIRC, to turn the C++ into C, with all the C++ features
hanging out
- debug that!
 
M

mkorobko

This is one of those questions where you will also get good answers from the
forum covering your own compiler.

I would...

 - debug the code and step into each method
 - debug with the disassembly turned on, so you can see the opcodes
 - use cfront, IIRC, to turn the C++ into C, with all the C++ features
hanging out
 - debug that!

Thank you.
 
B

Bart van Ingen Schenau

I was wondering if there is a way to see the source code generated by
compiler - anything that compiler inserts such as constructors,
destructors, vptr, etc . Looking at this can help to learn.

No, you can't obtain any source code for the compiler-generated parts
of the program, because the compiler does not create source code for
that.
The best you can get is to ask the compiler to output (annotated)
assembly code, but be aware that optimisations can make it very hard
to recognise your own code in the produced assembly.

Bart v Ingen Schenau
 
M

mkorobko

No, you can't obtain any source code for the compiler-generated parts
of the program, because the compiler does not create source code for
that.
The best you can get is to ask the compiler to output (annotated)
assembly code, but be aware that optimisations can make it very hard
to recognise your own code in the produced assembly.

Bart v Ingen Schenau

Thanks everyone for your replies. It was helpful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top