compiler options to display types?

Discussion in 'C Programming' started by bsd_mike, Oct 13, 2005.

  1. bsd_mike

    bsd_mike Guest

    I am working with some purchased source code which
    contains types which are structures which themselves
    contain structures and even more structures.
    Each field in the structure is itself its own datatype.

    Is there a tool I can use that I can wrap a structure
    and have it dump out the composition based on basic
    types?

    Thanks,
    Mike
     
    bsd_mike, Oct 13, 2005
    #1
    1. Advertising

  2. In article <>,
    bsd_mike <> wrote:

    >I am working with some purchased source code which
    >contains types which are structures which themselves
    >contain structures and even more structures.
    >Each field in the structure is itself its own datatype.


    >Is there a tool I can use that I can wrap a structure
    >and have it dump out the composition based on basic
    >types?


    Standard C makes no attempt to be "reflective" -- no attempt, that
    is, to allow you to use your program to examine your program.
    And anything having to do with compiler options is going to be
    compiler specific, and this newsgroup only talks about standard (portable) C.


    It -is- within the rhelm of possibility to use standard C to write
    a program whose input is the program you want analyzed. That analysis
    program would have to be a close approximation of being a compiler,
    as it would have to know about conditional compilation and about
    all the ways C types can be built up, it would have to know about
    default typing, and it would have to know about scoping rules.
    I don't think I could name a suitable program, but it would not surprise
    me if one existed.
    --
    I am spammed, therefore I am.
     
    Walter Roberson, Oct 13, 2005
    #2
    1. Advertising

  3. bsd_mike

    Mike Wahler Guest

    "bsd_mike" <> wrote in message
    news:...
    >
    > I am working with some purchased source code which
    > contains types which are structures which themselves
    > contain structures and even more structures.
    > Each field in the structure is itself its own datatype.
    >
    > Is there a tool I can use that I can wrap a structure
    > and have it dump out the composition based on basic
    > types?


    Perhaps (have you asked Google?). But creating such a
    tool would imo be a good exercise. And by the time
    you're done, you'd be well on the way to writing a
    compiler. :)

    -Mike
     
    Mike Wahler, Oct 14, 2005
    #3
  4. bsd_mike

    Marc Boyer Guest

    Le 13-10-2005, bsd_mike <> a écrit :
    > I am working with some purchased source code which
    > contains types which are structures which themselves
    > contain structures and even more structures.
    > Each field in the structure is itself its own datatype.
    >
    > Is there a tool I can use that I can wrap a structure
    > and have it dump out the composition based on basic
    > types?


    For which purpose ?
    Any reasonnable debuger will show you the composition
    of variables of a given type. It can help you to
    understand a non/bad documented code.

    Marc Boyer
     
    Marc Boyer, Oct 14, 2005
    #4
  5. In article <>, "bsd_mike" <> writes:
    >
    > I am working with some purchased source code which
    > contains types which are structures which themselves
    > contain structures and even more structures.
    > Each field in the structure is itself its own datatype.
    >
    > Is there a tool I can use that I can wrap a structure
    > and have it dump out the composition based on basic
    > types?


    Not as part of the standard language, but you may want to try Doxygen,
    a free documentation generator (similar to javadoc but for a variety
    of languages). It has an "automatic" mode where it generates HTML
    documentation from unannotated source; you can use the result to
    examine a structure type or variable and drill down through its com-
    ponent types.

    http://www.doxygen.org

    --
    Michael Wojcik

    The way things were, were the way things were, and they stayed that way
    because they had always been that way. -- Jon Osborne
     
    Michael Wojcik, Oct 14, 2005
    #5
    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. Cliff  Martin
    Replies:
    1
    Views:
    3,045
    Larry Smith
    Jan 31, 2007
  2. jacksu
    Replies:
    0
    Views:
    514
    jacksu
    Oct 9, 2007
  3. Utkado
    Replies:
    2
    Views:
    2,122
  4. Bryan Richardson
    Replies:
    6
    Views:
    292
    Bryan Richardson
    Feb 25, 2008
  5. Sijo Kg
    Replies:
    1
    Views:
    102
    Justin Collins
    Jan 7, 2009
Loading...

Share This Page