On Wed, Apr 8, 2009 at 9:08 AM, Kiran Divakaran
<[email protected]> wrote:
> I have a query with #defines in C.
>
> There is a -E compiler option which would expand the #define at compile time
> and create an intermediate file and create the object file for the same.
>
> But normally do #defines get expanded at compile time or at run time.
Pre-processor directives technically are handled even before the
compile stage, they get expanded by the pre-processor before the code
is compiled. By the time the code is compiled, no traces of the
original pre-processor directives are left behind. Run gcc with the -E
option and you will see what the pre-processed code looks like -- you
will see the contents of, say, stdio.h included in the output and all
of the #defined macros expanded.
-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world."
-- Jelaleddin Rumi