Preprocessor

Discussion in 'C Programming' started by sangeeta chowdhary, Jun 30, 2010.

  1. Hi,

    I am using macro in my code,and I am using GCC compiler.
    I want to see expanded file ,I want to see how macro is expanded
    in my code by preprocessor before compilation.
    Is there any command for it?
    sangeeta chowdhary, Jun 30, 2010
    #1
    1. Advertising

  2. sangeeta chowdhary

    Rob Kendrick Guest

    On Wed, 30 Jun 2010 03:22:15 -0700 (PDT)
    sangeeta chowdhary <> wrote:

    > I am using macro in my code,and I am using GCC compiler.
    > I want to see expanded file ,I want to see how macro is expanded
    > in my code by preprocessor before compilation.
    > Is there any command for it?


    You want "-E". See `man gcc`.

    B.
    Rob Kendrick, Jun 30, 2010
    #2
    1. Advertising

  3. On Jun 30, 3:29 pm, Rob Kendrick <> wrote:
    > On Wed, 30 Jun 2010 03:22:15 -0700 (PDT)
    >
    > sangeeta chowdhary <> wrote:
    > > I am using macro in my code,and I am using GCC compiler.
    > > I want to see expanded file ,I want to see how macro is expanded
    > > in my code by preprocessor before compilation.
    > > Is there any command for it?

    >
    > You want "-E".  See `man gcc`.
    >
    > B.


    Thanks
    sangeeta chowdhary, Jun 30, 2010
    #3
  4. On Jun 30, 3:42 pm, pete <> wrote:
    > sangeeta chowdhary wrote:
    >
    > > Hi,

    >
    > > I am using macro in my code,and I am using GCC compiler.
    > > I want to see expanded file ,I want to see how macro is expanded
    > > in my code by preprocessor before compilation.
    > > Is there any command for it?

    >
    > Sometimes you can use the xstr macro,
    > which I copied from the C standard.
    > Though I have heard that sometimes,
    > implementation macros may contain characters
    > which render them unprintable this way.
    >
    > /* BEGIN new.c */
    >
    > #include <stdio.h>
    >
    > #define str(s)      # s
    > #define xstr(s)     str(s)
    >
    > int main(void)
    > {
    >
    > #ifdef putchar
    >     puts("The putchar macro looks like this:\n\n"
    >         "#define putchar(X) \\");
    >     puts(xstr(putchar(X)));
    > #else
    >     puts("putchar is not a macro on this implementation");
    > #endif
    >
    >     return 0;
    >
    > }
    >
    > /* END new.c */
    >
    > --
    > pete


    Thanks Sir
    sangeeta chowdhary, Jun 30, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris P
    Replies:
    0
    Views:
    440
    Chris P
    Oct 28, 2003
  2. The Weiss Family

    VHDL Preprocessor

    The Weiss Family, Jul 14, 2004, in forum: VHDL
    Replies:
    2
    Views:
    3,218
    The Weiss Family
    Jul 14, 2004
  3. =?Utf-8?B?SSBhbSBTYW0=?=

    C# Preprocessor

    =?Utf-8?B?SSBhbSBTYW0=?=, Mar 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,577
    =?Utf-8?B?SSBhbSBTYW0=?=
    Mar 13, 2005
  4. Replies:
    0
    Views:
    2,671
  5. Cronus
    Replies:
    1
    Views:
    667
    Paul Mensonides
    Jul 15, 2004
Loading...

Share This Page