For Programmers: Free Programming Magazines  


Home > Archive > C > February 2006 > please explain clearly what actually happens after i click on COMPILE









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author please explain clearly what actually happens after i click on COMPILE
srikanth

2006-02-28, 7:55 am

what are the processes that happen after compile starts





//////////////////
-----------------------------why is it i find 150 or 100 lines compiled
in the message box though it is a 10 or 09 lines program

osmium

2006-02-28, 7:55 am

"srikanth" wrote:

> what are the processes that happen after compile starts
>
>
>
>
>
> //////////////////
> -----------------------------why is it i find 150 or 100 lines compiled
> in the message box though it is a 10 or 09 lines program


Try posting in alt.occult.methods


pemo

2006-02-28, 7:55 am

srikanth wrote:
> what are the processes that happen after compile starts
>
>
>
>
>
> //////////////////
> -----------------------------why is it i find 150 or 100 lines
> compiled in the message box though it is a 10 or 09 lines program


You're probably including a header file, although the program you entered is
just a few lines.

The compiler has to process your program after any #include directive has
been processed, i.e. #include<stdio.h> has been *replaced* by the contents
of the file stdio.h by the pre-processor - thus the larger number of lines
the compiler is claiming that it's compiled.


--
==============
Not a pedant
==============


Richard Heathfield

2006-02-28, 7:55 am

srikanth said:

> what are the processes that happen after compile starts


The compilation process involves seven distinct translation phases (there is
an eighth, but that's to do with linking, not compilation). The
implementation is free to merge separate phases as long as this doesn't
change the behaviour of the resulting code.

The phases are:

1) Translation from physical environment to source environment, if
necessary, and trigraph replacement.

2) Line splicing.

3) Decomposition into preprocessing tokens, and comment removal.

4) Preprocessing (#include, #define, and all that).

5) Conversion of character constants and string literals from the source
character set into the execution character set.

6) Concatenation of string literals.

7) Compilation (or interpretation).

> -----------------------------why is it i find 150 or 100 lines compiled
> in the message box though it is a 10 or 09 lines program


It is probably because your implementation is reporting on the total number
of lines, including those resulting from a #include (possibly a standard
header).

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com