GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 26-Nov-2004, 15:54
BobbyMurcerFan BobbyMurcerFan is offline
Member
 
Join Date: May 2004
Posts: 103
BobbyMurcerFan is on a distinguished road

Compiler that Shows Stages of Compilation?


Is there a C or C++ compiler that explicitly shows the different stages of compilation?

For example, show what the source code looks like after:

The line breaks are removed.

The comments are removed.

The #include directives have been performed.

I just think it would be helpful to actually see the different stages the source codes goes through on its way to becoming object and finally executable code.

I dobut a "regular" compiler would have this feature, but what about one designed for the educational market?

Thanks .
  #2  
Old 26-Nov-2004, 16:26
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,720
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by BobbyMurcerFan
Is there a C or C++ compiler that explicitly shows the different stages of compilation?

For example, show what the source code looks like after preprocessing (this is the stuff that actually gets sent to the compiler.

The line breaks are removed.

The comments are removed.

The #include directives have been performed.

I just think it would be helpful to actually see the different stages the source codes goes through on its way to becoming object and finally executable code.

I dobut a "regular" compiler would have this feature, but what about one designed for the educational market?

Thanks .


If you have GNU compilers (gcc, g++) you can run the preprocessor separately.

do this to see what the preprocessor does to source file xxx.c:
Quote:
cpp xxx.c




do man cpp to see options, etc.

To see assembly language generated from your c program, try

Quote:
cpp -S xxx.c

Thic creates assembly language file xxx.S

If you have Visual C++, you can try the following to see the preprocessor output:
Quote:
cl /E xxx.c

use the following to see other options:

Quote:
cl /?

to see assembly language do this

Quote:
cl -S xxx.c

This time you get xxx.asm

There are command line switches for Borland bcc32; just enter the following (no arguments)

Quote:
bcc32

You will see the options (assuming bcc32.exe is on your %PATH%)



Regards,

Dave
  #3  
Old 26-Nov-2004, 18:03
BobbyMurcerFan BobbyMurcerFan is offline
Member
 
Join Date: May 2004
Posts: 103
BobbyMurcerFan is on a distinguished road
Thanks Dave!!

It's very interesting to see what the preprocessed source code and Assembly language look like.

I tried a little test: I included additional header files, and as expected, the preprocessed code grew in size.

However, the Assembly code is only slightly different in size. Very interesting (to me anyway). I've looked at the .asm files and they are mostly the same, but there are slight differences.

Thanks!
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 2) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
32 bit compiler needed meet_raman C++ Forum 2 24-Jun-2004 03:42
a noobish compiler question Charunks C++ Forum 5 03-Sep-2003 02:18
i need a free Mac compiler yerdos C++ Forum 1 28-Jul-2003 02:12

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:28.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.