how to interpret this c statement

Discussion in 'C Programming' started by chao liu, Aug 7, 2004.

  1. chao liu

    chao liu Guest

    hi, all,

    Just confused with the following type definition. I will greatly appreciate
    your comments on it and especially to explanations

    struct prod_token_parm_item;
    typedef struct GTY(()) prod_token_parm_item item;

    so why there are so many brace following GTY and what's the meaning of this?

    thanks,
    Chao
    chao liu, Aug 7, 2004
    #1
    1. Advertising

  2. chao liu

    jacob navia Guest

    "chao liu" <> a écrit dans le message de
    news:cf3a47$rke$...
    > hi, all,
    >
    > Just confused with the following type definition. I will greatly

    appreciate
    > your comments on it and especially to explanations
    >
    > struct prod_token_parm_item;
    > typedef struct GTY(()) prod_token_parm_item item;
    >
    > so why there are so many brace following GTY and what's the meaning of

    this?
    >
    > thanks,
    > Chao
    >
    >


    To understand this code you have to run it through the preprocessor.
    Normally GTY should be a macro since it is all in uppercase, Traditionally
    macros are written all in uppercase.

    The first step of a compilation is to run the preprocessor, translating
    macros.

    Most compilers will answer to

    cc -E

    or similar, and will write the preprocessor output either into a file
    or into the screen.

    Then look at the line where you find both the word
    "typedef"
    and
    "prod_token_parm_item"

    and verify if this is the correct line.

    Then, look at the output, and see what C statement was being
    generated.

    This is the only way to understand this, or try to find the macro definition
    of GTY.

    grep GTY *.h

    comes to mind.
    jacob navia, Aug 7, 2004
    #2
    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. Aliki
    Replies:
    3
    Views:
    742
    LostAtC
    Sep 24, 2004
  2. James Hunt
    Replies:
    0
    Views:
    443
    James Hunt
    May 19, 2004
  3. Seetha J
    Replies:
    1
    Views:
    3,430
    Robbe Morris [C# MVP]
    May 17, 2005
  4. yzzzzz
    Replies:
    0
    Views:
    849
    yzzzzz
    Jan 7, 2005
  5. wenmang
    Replies:
    1
    Views:
    401
    Richard Tobin
    Jul 23, 2003
Loading...

Share This Page